Skip to content

Commit 9051695

Browse files
Philippe Addorengswee
authored andcommitted
add update-deploy script
1 parent 62003d6 commit 9051695

2 files changed

Lines changed: 46 additions & 46 deletions

File tree

.github/workflows/.gitlab-ci.yml

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,45 @@
11
stages:
2-
- snapshot
2+
- update
3+
- deploy
34

45
variables:
5-
ARTIFACT_DIRECTORY: "backup"
6-
EXCLUDED_IDS: "packageName1,packageName2"
7-
INCLUDED_IDS: ""
8-
DRAFT_HANDLING: "ADD" #SKIP, ERROR
9-
COMMIT_MESSAGE: "Automated tenant backup by FlashPipe-powered Gitlab CI/CD pipeline"
106
TMN_HOST: $DEV_TMN_HOST
117
OAUTH_HOST: $DEV_OAUTH_HOST
128
OAUTH_CLIENTID: $DEV_CLIENT_ID
139
OAUTH_CLIENTSECRET: $DEV_CLIENT_SECRET
1410

15-
take_snapshot:
16-
stage: snapshot
11+
update_artifact:
12+
stage: update
1713
image: engswee/flashpipe:latest
1814
script:
19-
- echo "Checking out main branch"
20-
- git fetch origin main # Fetch the main branch from the remote
21-
- git checkout main # Checkout the main branch locally in order to be able to push it back afterwards
22-
- echo "Delete all previously backed-up files and download again the current state of the tenant"
23-
- git rm -rf ./backup
24-
- 'echo "Taking a snapshot with the following parameters:"'
25-
- 'echo "Directory: $ARTIFACT_DIRECTORY"'
26-
- 'echo "Excluded IDs: $EXCLUDED_IDS"'
27-
- 'echo "Included IDs: $INCLUDED_IDS"'
28-
- 'echo "Draft Handling: $DRAFT_HANDLING"'
29-
- 'echo "Commit Message: $COMMIT_MESSAGE"'
15+
- echo "Uploading/Updating artifact..."
3016
- >
31-
flashpipe snapshot
32-
--tmn-host $TMN_HOST
33-
--oauth-host $OAUTH_HOST
34-
--oauth-clientid $OAUTH_CLIENTID
35-
--oauth-clientsecret $OAUTH_CLIENTSECRET
36-
--dir-artifacts $ARTIFACT_DIRECTORY
37-
--draft-handling "$DRAFT_HANDLING"
38-
--git-commit-msg "$COMMIT_MESSAGE"
39-
--ids-exclude "$EXCLUDED_IDS"
40-
#--ids-include "$INCLUDED_IDS" # EITHER use included or excluded IDs parameter (remove the respective unneeded line from the file or keep it outside of the multi-line string started by ">"!)
41-
- echo "Push temporary pipeline-local repo to the Git repo"
42-
- git push https://gitlab-ci-token:$CI_JOB_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git main
43-
rules:
44-
- if: '$CI_PIPELINE_SOURCE == "schedule"'
45-
when: always # set to always run if triggered by schedule
46-
- when: manual # still allow manual triggering, but never trigger by pushed commits.
17+
flashpipe update artifact
18+
--tmn-host $TMN_HOST
19+
--oauth-host $OAUTH_HOST
20+
--oauth-clientid $OAUTH_CLIENTID
21+
--oauth-clientsecret $OAUTH_CLIENTSECRET
22+
--artifact-id myScriptCollection
23+
--package-id myPackage
24+
--dir-artifact artifact
25+
--artifact-type ScriptCollection
26+
- echo "Script Collection uploaded/updated successfully."
27+
only:
28+
- main
29+
30+
deploy_artifact:
31+
stage: deploy
32+
image: engswee/flashpipe:latest
33+
script:
34+
- echo "Deploying artifact to tenant"
35+
- >
36+
flashpipe deploy
37+
--tmn-host $TMN_HOST
38+
--oauth-host $OAUTH_HOST
39+
--oauth-clientid $OAUTH_CLIENTID
40+
--oauth-clientsecret $OAUTH_CLIENTSECRET
41+
--artifact-ids myScriptCollection
42+
--artifact-type ScriptCollection
43+
- echo "Script Collection artifact deployed successfully."
44+
only:
45+
- main

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ This repository holds the various usage examples of [FlashPipe](https://github.c
44

55
## Examples
66

7-
| Branch | Platform | Details |
8-
|-------------------------------------------------------------------------------------------------------|-----------------|-----------------------------------------------------------------------------------------------|
9-
| [azure-pipelines](https://github.com/engswee/flashpipe-demo/tree/azure-pipelines) | Azure Pipelines | Multiples IFlow deployed to multiple tenants. Unit testing using Maven |
10-
| [azure-pipelines-single](https://github.com/engswee/flashpipe-demo/tree/azure-pipelines-single) | Azure Pipelines | Single IFlow uploaded and deployed to a single tenant |
11-
| [github-actions](https://github.com/engswee/flashpipe-demo/tree/github-actions) | GitHub Actions | Multiple artifact types uploaded and deployed to a single tenant. Unit testing with Maven |
12-
| [github-actions-sync](https://github.com/engswee/flashpipe-demo/tree/github-actions-sync) | GitHub Actions | Sync single package contents between tenant and GitHub repository |
13-
| [github-actions-snapshot](https://github.com/engswee/flashpipe-demo/tree/github-actions-snapshot) | GitHub Actions | Snapshot tenant's contents (editable packages) to GitHub repository |
14-
| [gitlab-snapshot](https://github.com/engswee/flashpipe-demo/tree/gitlab-snapshot) | GitLab | Snapshot tenant's contents (editable packages) to GitLab repository |
15-
| [azure-pipelines-neo](https://github.com/engswee/flashpipe-demo/tree/azure-pipelines-neo) | Azure Pipelines | Single IFlow uploaded and deployed to a single tenant (OAuth on Neo environment) - Deprecated |
16-
| [github-actions-simulation](https://github.com/engswee/flashpipe-demo/tree/github-actions-simulation) | GitHub Actions | Simulation testing with Maven - Deprecated |
17-
| [github-actions-sync-apim](https://github.com/engswee/flashpipe-demo/tree/github-actions-sync-apim) | GitHub Actions | Sync API Management contents between tenant and GitHub repository |
7+
| Branch | Platform | Details |
8+
|-------------------------------------------------------------------------------------------------------|-----------------|-----------------------------------------------------------------------------------------------------|
9+
| [azure-pipelines](https://github.com/engswee/flashpipe-demo/tree/azure-pipelines) | Azure Pipelines | Multiples IFlow deployed to multiple tenants. Unit testing using Maven |
10+
| [azure-pipelines-single](https://github.com/engswee/flashpipe-demo/tree/azure-pipelines-single) | Azure Pipelines | Single IFlow uploaded and deployed to a single tenant |
11+
| [github-actions](https://github.com/engswee/flashpipe-demo/tree/github-actions) | GitHub Actions | Multiple artifact types uploaded and deployed to a single tenant. Unit testing with Maven |
12+
| [gitlab-update-deploy](https://github.com/engswee/flashpipe-demo/tree/gitlab-update-deploy) | GitLab | Example for uploading and deploying a ScriptCollection to a single tenant from a GitLab repository. |
13+
| [github-actions-sync](https://github.com/engswee/flashpipe-demo/tree/github-actions-sync) | GitHub Actions | Sync single package contents between tenant and GitHub repository |
14+
| [github-actions-snapshot](https://github.com/engswee/flashpipe-demo/tree/github-actions-snapshot) | GitHub Actions | Snapshot tenant's contents (editable packages) to GitHub repository |
15+
| [gitlab-snapshot](https://github.com/engswee/flashpipe-demo/tree/gitlab-snapshot) | GitLab | Snapshot tenant's contents (editable packages) to GitLab repository |
16+
| [azure-pipelines-neo](https://github.com/engswee/flashpipe-demo/tree/azure-pipelines-neo) | Azure Pipelines | Single IFlow uploaded and deployed to a single tenant (OAuth on Neo environment) - Deprecated |
17+
| [github-actions-simulation](https://github.com/engswee/flashpipe-demo/tree/github-actions-simulation) | GitHub Actions | Simulation testing with Maven - Deprecated |
18+
| [github-actions-sync-apim](https://github.com/engswee/flashpipe-demo/tree/github-actions-sync-apim) | GitHub Actions | Sync API Management contents between tenant and GitHub repository |

0 commit comments

Comments
 (0)