Skip to content

Commit

Permalink
add ability to deploy with argo
Browse files Browse the repository at this point in the history
  • Loading branch information
nhudson committed Aug 3, 2024
1 parent bd49ad6 commit f59d5f4
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 1 deletion.
75 changes: 75 additions & 0 deletions .github/actions/argocd-update/action.yml
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 }}
1 change: 0 additions & 1 deletion .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ jobs:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
strategy:
# fail-fast means to cancel all jobs if one fails
fail-fast: false
matrix:
include:
Expand Down

0 comments on commit f59d5f4

Please sign in to comment.