Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mintmaker: add staging to production promotion pipeline #5171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .tekton/mintmaker-prod-overlay-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: mintmaker-prod-overlay-update
namespace: tekton-ci
annotations:
pipelinesascode.tekton.dev/on-cel-expression: |
event == "push" && target_branch == "main" && "components/mintmaker/staging/base/kustomization.yaml".pathChanged()
pipelinesascode.tekton.dev/max-keep-runs: "5"
pipelinesascode.tekton.dev/task: "[.tekton/tasks/promote-component.yaml]"
spec:
pipelineSpec:
tasks:
- name: promote-component-from-stage-to-prod
params:
- name: BRANCH_NAME
value: stage-to-prod-mintmaker
- name: COMPONENT_NAME
value: mintmaker
- name: SCRIPT
value: |
# Extract SHAs from staging
DEFAULT_CONFIG_SHA=$(awk -F= '/default\?ref=/{print $2}' staging/base/kustomization.yaml)
RENOVATE_CONFIG_SHA=$(awk -F= '/renovate\?ref=/{print $2}' staging/base/kustomization.yaml)
CONTROLLER_IMAGE_SHA=$(awk '/newName: quay\.io\/konflux-ci\/mintmaker$/{p=NR+1} NR<=p{if($1=="newTag:") print $2}' staging/base/kustomization.yaml)
RENOVATE_IMAGE_SHA=$(awk '/newName: quay\.io\/konflux-ci\/mintmaker-renovate-image$/{p=NR+1} NR<=p{if($1=="newTag:") print $2}' staging/base/kustomization.yaml)

# Update SHAs in production
if [ -n "$DEFAULT_CONFIG_SHA" ]; then
echo "Updating prod default config SHA to $DEFAULT_CONFIG_SHA"
sed -i "/default?ref/s/ref=.*$/ref=$DEFAULT_CONFIG_SHA/" production/base/kustomization.yaml
fi

if [ -n "$RENOVATE_CONFIG_SHA" ]; then
echo "Updating prod renovate config SHA to $RENOVATE_CONFIG_SHA"
sed -i "/renovate?ref/s/ref=.*$/ref=$RENOVATE_CONFIG_SHA/" production/base/kustomization.yaml
fi

if [ -n "$CONTROLLER_IMAGE_SHA" ]; then
echo "Updating prod controller image SHA to $CONTROLLER_IMAGE_SHA"
sed -i "/newName: quay\.io\/konflux-ci\/mintmaker$/,/newTag:/s/newTag:.*/newTag: $CONTROLLER_IMAGE_SHA/" production/base/kustomization.yaml
fi

if [ -n "$RENOVATE_IMAGE_SHA" ]; then
echo "Updating prod renovate image SHA to $RENOVATE_IMAGE_SHA"
sed -i "/newName: quay\.io\/konflux-ci\/mintmaker-renovate-image$/,/newTag:/s/newTag:.*/newTag: $RENOVATE_IMAGE_SHA/" production/base/kustomization.yaml
fi

echo "Updated production kustomization.yaml with staging SHAs"
taskRef:
name: promote-component
Loading