Last active
January 9, 2025 08:35
-
-
Save unclebean/cde3d1344353e9b7c1cc7a067f415c8d to your computer and use it in GitHub Desktop.
helm
This file contains hidden or 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
# get release name from k8s | |
kubectl get secrets -n <namespace> | grep sh.helm.release | |
deploy: | |
stage: deploy | |
script: | |
- export IMAGE_TAG=${CI_COMMIT_TAG:-latest} # Fallback to 'latest' if not set | |
- sed -i "s/tag:.*/tag: ${IMAGE_TAG}/" values.yaml | |
- helm upgrade --install my-release my-chart -f values.yaml | |
trigger_another_project: | |
stage: trigger | |
trigger: | |
project: $CI_PROJECT_NAMESPACE/target-project # Use namespace to reference the target project | |
branch: main # Target branch to trigger | |
variables: | |
VAR1: "value1" | |
VAR2: "value2" | |
IMAGE_TAG: "${CI_COMMIT_SHA:0:7}" | |
stages: | |
- prepare | |
- trigger | |
prepare_short_sha: | |
stage: prepare | |
script: | |
- export SHORT_SHA=$(echo $CI_COMMIT_SHA | cut -c1-7) | |
- echo "SHORT_SHA=$SHORT_SHA" >> build.env | |
artifacts: | |
reports: | |
dotenv: build.env | |
trigger_target_pipeline: | |
stage: trigger | |
trigger: | |
project: $CI_PROJECT_NAMESPACE/target-project | |
branch: main | |
dependencies: | |
- prepare_short_sha | |
variables: | |
IMAGE_TAG: $SHORT_SHA |
This file contains hidden or 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
- name: Update Docker image tag in values.yaml | |
ansible.builtin.lineinfile: | |
path: /path/to/values.yaml | |
regexp: '^\s*tag:.*' | |
line: 'tag: {{ docker_image_tag }}' | |
backrefs: yes |
This file contains hidden or 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
metadata: | |
annotations: | |
azure.workload.identity/client-id: <uami-client-id> | |
azure.workload.identity/tenant-id: <tenant-id> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment