-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: "Argo CD update" | ||
description: "Push changes to a branch in ArgoCD" | ||
inputs: | ||
repository: | ||
description: "The ArgoCD repository" | ||
required: true | ||
ssh_key: | ||
description: "The SSH key for the repository" | ||
required: true | ||
branch: | ||
description: "The branch to update" | ||
required: true | ||
version: | ||
description: "The version to use for updating" | ||
required: true | ||
subdirectory: | ||
description: "The subdirectory to update" | ||
required: true | ||
clone_into: | ||
description: "The directory to clone the argocd repo into" | ||
default: "argocd-repo" | ||
required: false | ||
outputs: {} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ inputs.repository }} | ||
ssh-key: ${{ inputs.ssh_key }} | ||
path: ${{ inputs.clone_into }} | ||
- name: Git commit and push to remote | ||
shell: bash | ||
run: | | ||
set -xe | ||
cd ${{ inputs.clone_into }} | ||
git config --global user.name "coredb-service-user" | ||
git config --global user.email "[email protected]" | ||
git fetch origin ${{ inputs.branch }} && git checkout ${{ inputs.branch }} || git checkout -b ${{ inputs.branch }} | ||
- name: Update for dev or staging deployments | ||
if: inputs.branch == 'staging-updates' || (inputs.branch == 'main' && inputs.subdirectory == 'dev') | ||
uses: mikefarah/[email protected] | ||
with: | ||
cmd: | | ||
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-use1.yaml | ||
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-euc1.yaml | ||
yq -i '(.spec.source.helm.parameters.[] | select(.name == "image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-use1.yaml | ||
yq -i '(.spec.source.helm.parameters.[] | select(.name == "image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-euc1.yaml | ||
- name: Update for prod deployments | ||
if: inputs.branch == 'prod-updates' | ||
uses: mikefarah/[email protected] | ||
with: | ||
cmd: | | ||
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-use1.yaml | ||
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-euc1.yaml | ||
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-apse1.yaml | ||
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-usw2.yaml | ||
yq -i '(.spec.source.helm.parameters.[] | select(.name == "image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-use1.yaml | ||
yq -i '(.spec.source.helm.parameters.[] | select(.name == "image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-euc1.yaml | ||
yq -i '(.spec.source.helm.parameters.[] | select(.name == "image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-apse1.yaml | ||
yq -i '(.spec.source.helm.parameters.[] | select(.name == "image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-metrics-usw2.yaml | ||
- name: Git commit and push to remote | ||
shell: bash | ||
run: | | ||
set -xe | ||
cd ${{ inputs.clone_into }} | ||
git add --all | ||
# debugging | ||
git diff HEAD | ||
git commit -m "Update from coredb-io/control-plane: ${{ inputs.version }}" | ||
git push origin ${{ inputs.branch }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters