This commit is contained in:
@ -26,10 +26,41 @@ steps:
|
||||
io.kubernetes.cri-o.userns-mode: "auto:size=65536"
|
||||
runtimeClassName: sysbox-runc
|
||||
|
||||
- name: test-env
|
||||
image: alpine
|
||||
- name: gitops-commit
|
||||
image: alpine/git
|
||||
environment:
|
||||
MY_VAR: test-value
|
||||
DEPLOY_REPO: ssh://git@srv22.mikr.us:20343/pikram/user-microservice-deploy.git
|
||||
GITEA_DEPLOY_KEY:
|
||||
from_secret: gitea-deploy-key
|
||||
GITEA_KNOWN_HOST:
|
||||
from_secret: gitea-known-host
|
||||
commands:
|
||||
- echo "Value of MY_VAR $MY_VAR"
|
||||
- env | grep MY_VAR
|
||||
- mkdir -p ~/.ssh
|
||||
|
||||
- echo "$${GITEA_KNOWN_HOST}" >> ~/.ssh/known_hosts
|
||||
- chmod 644 ~/.ssh/known_hosts
|
||||
|
||||
- echo "$${GITEA_DEPLOY_KEY}" > ~/.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 "${DEPLOY_REPO}" --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