Skip to content

Commit

Permalink
Github action to push helm to gitops repo
Browse files Browse the repository at this point in the history
  • Loading branch information
barrfalk committed Dec 19, 2023
1 parent b752e96 commit 5c4e41d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 16 deletions.
48 changes: 35 additions & 13 deletions .github/workflows/.push-helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,38 @@ jobs:
# If here skip deployment
echo "No triggers have fired, deployment skipped"
- name: Echo Helm Version
run: helm version
- name: Package Helm Chart - Update
working-directory: ${{ inputs.directory }}
run:
helm dependency update
- name: Package Helm Chart
working-directory: ${{ inputs.directory }}
run: helm package --app-version="${{ env.package_tag }}" --version=${{ inputs.tag }} .
- name: Login to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push Helm Chart as OCI Artifact
run: helm push ./charts/nr-compliance-enforcement-cm/nr-compliance-enforcement-cm-${{ inputs.tag }}.tgz oci://ghcr.io/${{ github.repository_owner }}/nr-compliance-enforcement-cm
- name: Setup Git
run: |
git config --global user.name 'Your Name'
git config --global user.email 'your-email@example.com'
- name: Clone Target Repository
env:
REMOTE_REPO_TOKEN: ${{ secrets.REMOTE_REPO_TOKEN }}
run: |
git clone https://x-access-token:$REMOTE_REPO_TOKEN@github.com/bcgov-c/nr-compliance-enforcement-cm.git target-repo
cd target-repo
git checkout -b update-helm-chart
- name: Copy Helm Chart
run: |
cp -r ./charts/* ./helm-chart/
cd target-repo
- name: Commit and Push Changes
env:
REMOTE_REPO_TOKEN: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}
run: |
git add .
git commit -m "Update Helm chart"
git push --set-upstream origin update-helm-chart
- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}
pr_title: "Update Helm Chart"
pr_body: "Automated update of Helm chart"
destination_branch: "main"
source_branch: "update-helm-chart"
6 changes: 3 additions & 3 deletions charts/nr-compliance-enforcement-cm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ global:
#-- the registry where the images are stored. override during runtime for other registry at global level or individual level.
repository:
#-- the registry where the images are stored. override during runtime for other registry at global level or individual level. default is ghcr.io
registry: ghcr.io
registry: artifacts.developer.gov.bc.ca #:443/artifactory/github-docker-remote/bcgov/nr-compliance-enforcement-cm/
#-- the tag of the image, it can be latest, 1.0.0 etc..., or the sha256 hash
tag: ~
tag: latest
#-- turn off autoscaling for the entire suite by setting this to false. default is true.
autoscaling: true
#-- global secrets, can be accessed by sub-charts.
Expand All @@ -19,7 +19,7 @@ global:
annotation:
helm.sh/policy: "keep"
#-- domain of the application, it is required, apps.silver.devops.gov.bc.ca for silver cluster and apps.devops.gov.bc.ca for gold cluster
domain: "apps.silver.devops.gov.bc.ca"
domain: "apps.emerald.devops.gov.bc.ca"
#-- the image registry of OpenShift. It is used in conjunction with ImageStreams which is a OpenShift specific resource.
openshiftImageRegistry: "image-registry.openshift-image-registry.svc:5000"
#-- the database Alias gives a nice way to switch to different databases, crunchy, patroni ... etc.
Expand Down

0 comments on commit 5c4e41d

Please sign in to comment.