This commit is contained in:
@ -29,7 +29,38 @@ steps:
|
|||||||
- name: gitops-commit
|
- name: gitops-commit
|
||||||
image: alpine/git
|
image: alpine/git
|
||||||
environment:
|
environment:
|
||||||
MY_VAR: test-value
|
MY_VAR1: test-value
|
||||||
|
MY_VAR2:
|
||||||
|
from_secret: gitea-deploy-key
|
||||||
|
MY_VAR3:
|
||||||
|
from_secret: gitea-known-host
|
||||||
commands:
|
commands:
|
||||||
- echo "Value of MY_VAR $MY_VAR"
|
- mkdir -p ~/.ssh
|
||||||
- env | grep MY_VAR
|
|
||||||
|
- echo "${MY_VAR3}" >> ~/.ssh/known_hosts
|
||||||
|
- chmod 644 ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- echo "${MY_VAR2}" > ~/.ssh/id_rsa
|
||||||
|
- chmod 600 ~/.ssh/id_rsa
|
||||||
|
|
||||||
|
- git config --global user.name "woodpecker[bot]"
|
||||||
|
- git config --global user.email "woodpecker@marcin00.pl"
|
||||||
|
|
||||||
|
- git clone "${MY_VAR1}" --branch woodpecker-deploy
|
||||||
|
- cd user-microservice-deploy
|
||||||
|
|
||||||
|
- |
|
||||||
|
awk -v commit="$CI_COMMIT_SHA" '
|
||||||
|
$0 ~ /name:[[:space:]]*api/ { in_api_container = 1; print; next }
|
||||||
|
in_api_container && $0 ~ /^[[:space:]]*image:[[:space:]]*/ {
|
||||||
|
sub(/:[^:[:space:]]+$/, ":" commit)
|
||||||
|
in_api_container = 0
|
||||||
|
print
|
||||||
|
next
|
||||||
|
}
|
||||||
|
{ print }
|
||||||
|
' deploy.yaml > deploy.tmp && mv deploy.tmp deploy.yaml
|
||||||
|
|
||||||
|
- git add deploy.yaml
|
||||||
|
- 'git diff-index --quiet HEAD || git commit -m "WOODPECKER: Changed deployed version to $CI_COMMIT_SHA"'
|
||||||
|
- git push origin woodpecker-deploy
|
||||||
|
Reference in New Issue
Block a user