Skip to content

Commit

Permalink
updating to have only one pull request with all changes from main
Browse files Browse the repository at this point in the history
Signed-off-by: Soule BA <bah.soule@gmail.com>
  • Loading branch information
souleb committed Mar 7, 2024
1 parent b3c6e86 commit 0e85963
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 26 deletions.
34 changes: 10 additions & 24 deletions .github/workflows/production-promotion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,23 @@ jobs:
github.event.client_payload.severity == 'info'
steps:
# Checkout main branch.
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: production
#Parse the event metadata to determine the chart version deployed on staging.
- name: Get chart version from staging
id: staging
fetch-depth: 0
# Commit changes from the main branch.
- name: Commit changes
id: commit
run: |
VERSION=$(echo ${{ github.event.client_payload.metadata.revision }} | cut -d '@' -f1)
NAME=$(echo ${{ github.event.client_payload.involvedObject.name }} | cut -d '@' -f1)
NAMESPACE=$(echo ${{ github.event.client_payload.involvedObject.namespace }} | cut -d '@' -f1)
echo VERSION=${VERSION} >> $GITHUB_OUTPUT
echo NAME=${NAME} >> $GITHUB_OUTPUT
echo NAMESPACE=${NAMESPACE} >> $GITHUB_OUTPUT
# Patch the chart version in the production Helm release manifest.
- name: Set chart version in production
id: production
env:
CHART_VERSION: ${{ steps.staging.outputs.version }}
NAME: ${{ steps.staging.outputs.name }}
NAMESPACE: ${{ steps.staging.outputs.namespace }}
run: |
echo "set chart version to ${CHART_VERSION}"
yq e '(select(.spec.chart.spec.version) | .spec.chart.spec.version) = env(CHART_VERSION)' -i ./components/${NAMESPACE}/base/${NAME}.yaml
git pull origin main
# Open a Pull Request if an upgraded is needed in production.
- name: Open promotion PR
uses: peter-evans/create-pull-request@v6
with:
branch: production-promotion-${{ steps.staging.outputs.name }}-${{ steps.staging.outputs.version }}
branch: production-promotion
delete-branch: true
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Promote chart ${{ steps.staging.outputs.name }} to version ${{ steps.staging.outputs.version }}
title: Promote chart ${{ steps.staging.outputs.name }} to version ${{ steps.staging.outputs.version }}
commit-message: Promote chart
title: Promote new changes to production
body: |
Promote chart ${{ steps.staging.outputs.name }} to version ${{ steps.staging.outputs.version }}.
Promote new changes to production
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ Then it will upgrade the Helm releases to the new version to the staging cluster
### Promotion to Production

After the HelmReleases are successfully installed or upgraded on the staging cluster, a promotion pipeline
is triggered to promote the changes to the production clusters. It effectively opens pull requests
on the `production` branch with the updated HelmChart versions.
is triggered to promote the changes to the production clusters. It effectively opens a pull request
on the `production` branch with the updated changes from the `main` branch. The pull request will
keep the changes in sync between the `main` and `production` branches as long as the pull request is open.

The promotion pipeline is defined in .github/workflows/production-promotion.yaml.
The `provider` and `alerts` used to trigger the promotion pipeline are defined in the `staging` directory
Expand Down

0 comments on commit 0e85963

Please sign in to comment.