Skip to content

Instantly share code, notes, and snippets.

@faiq
Created June 29, 2020 17:31
Show Gist options
  • Save faiq/bcf333804ebf5221c8be16ad7d6239f1 to your computer and use it in GitHub Desktop.
Save faiq/bcf333804ebf5221c8be16ad7d6239f1 to your computer and use it in GitHub Desktop.
update gitops
#!/bin/sh
# This script is used as part of the "update-argo" task from the Dispatchfile
COMMIT_SHA=$1
IMAGE_NAME=$2
BRANCH_NAME=$3
set -e
echo "$GPG_PRIVATE_KEY" > gpg_private_key
echo "$GPG_PUBLIC_KEY" > gpg_public_key
set -x
apt-get install -y wget
wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/3.3.0/yq_linux_amd64 && chmod +x /usr/local/bin/yq
gpg --import gpg_private_key
gpg --import gpg_public_key
git config --local commit.gpgsign true
git config --local user.signingkey $GPG_KEY_ID
git config --local user.name 'Dispatch CI'
git config --local user.email '[email protected]'
update-gitops-repo \
-git-revision=$COMMIT_SHA \
-filepath=argo/**.yaml.tmpl \
-substitute=imageName=$IMAGE_NAME \
-substitute=gitsha=$COMMIT_SHA \
-base-branch=$BRANCH_NAME \
-merge-pull-request=true \
-substitute=konvoyVersion=$(yq r cluster.yaml spec.version) \
-substitute=commitSHA=$COMMIT_SHA \
-commit-message="Deploy soak update"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment