Skip to content

Commit a15fcda

Browse files
committed
gitlab sample
1 parent 2fb7d93 commit a15fcda

File tree

6 files changed

+58
-0
lines changed

6 files changed

+58
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
stages:
2+
- dist
3+
4+
dist:
5+
stage: dist
6+
only:
7+
changes:
8+
- my_playbook
9+
image: "alpine:latest"
10+
before_script:
11+
- apk add --update zip git openssh openssh-client -f
12+
- git config --global user.email "${GITLAB_USER_EMAIL}"
13+
- git config --global user.name "${GITLAB_USER_NAME}"
14+
script:
15+
- zip -r my_playbook.zip my_playbook/*
16+
- git remote set-url --push origin http://oauth2:[email protected]:8085/$CI_PROJECT_PATH.git
17+
- git remote show origin
18+
- git status
19+
- git add my_playbook.zip
20+
- git commit -m "commit dist package from pipeline"
21+
- git status
22+
- git push origin HEAD:$CI_COMMIT_REF_NAME -o ci.skip
23+
- echo "done"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
asdf
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
asdf
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
run playbook
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Commit Zip to Branch
2+
When working with ansible playbook with multiple files, a zip archive needs to be committed to repo.
3+
4+
Some options to handle this pain point:
5+
1. Create zip locally on dev machine and push source changes and zip together
6+
2. Push source code, and have [gitlab-CI](commit-back-repo-gitlab-ci.yml) job detect change to playbook folder source code, create zip and commit
7+
- create access token for project and add as CI variable
8+
- this will create an additional commit to history
9+
- this also adds binary file into repo
10+
- need to remember to pull down the new "zip" commit before pushing new changes
11+
3. Have similar CI job detect change and generate zip, but push to external web server hosting instead of commiting binary
12+
- this adds dependency of setting up another web server (can also use cloudshell IIS server)
13+
- Can pass in branch name to name of zip to have different hosted zips for testing
14+
- Firewall rules can be placed on IIS to only allow downloads from the Execution Server
15+
- cleaner option in terms of git history and storage
16+
17+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
stages:
2+
- dist
3+
4+
dist:
5+
stage: dist
6+
only:
7+
changes:
8+
- my_playbook
9+
image: "alpine:latest"
10+
before_script:
11+
- apk add --update zip openssh openssh-client -f
12+
script:
13+
- zip -r my_playbook.zip my_playbook/*
14+
- scp my_playbook.zip username@IP_of_windows_machine:/C:/Config_Scripts
15+
- echo "done"

0 commit comments

Comments
 (0)