diff --git a/.github/workflows/create-gitops-deployments-pr.yaml b/.github/workflows/create-gitops-deployments-pr.yaml index e4f7cc4be..393c20262 100644 --- a/.github/workflows/create-gitops-deployments-pr.yaml +++ b/.github/workflows/create-gitops-deployments-pr.yaml @@ -175,8 +175,17 @@ jobs: author_email: "infra+yenkins@gooddata.com>" new_branch: "${{ steps.prepare-pr-metadata.outputs.branch_name }}" + - name: Report nothing to deploy + if: ${{ steps.commit-and-push.outputs.committed != 'true' }} + run: | + echo "### :information_source: Nothing to deploy" >> $GITHUB_STEP_SUMMARY + echo "The target HelmReleases already match the built chart and images, so no" >> $GITHUB_STEP_SUMMARY + echo "commit was produced and no gitops-deployments PR was opened." >> $GITHUB_STEP_SUMMARY + echo "Branch that would have been used: \`${{ steps.prepare-pr-metadata.outputs.branch_name }}\`" >> $GITHUB_STEP_SUMMARY + - name: Create PR id: create-pr + if: ${{ steps.commit-and-push.outputs.committed == 'true' }} run: | pr_url=$(gh pr create \ --title "${{ steps.prepare-pr-metadata.outputs.pr_title }}" \ @@ -195,14 +204,14 @@ jobs: GH_TOKEN: ${{ secrets.TOKEN_GITHUB_YENKINS }} - name: Upload PR URL - if: ${{ inputs.is_staging == false && inputs.is_auto_merge == true }} + if: ${{ steps.commit-and-push.outputs.committed == 'true' && inputs.is_staging == false && inputs.is_auto_merge == true }} uses: actions/upload-artifact@v4 with: name: "${{ inputs.cluster }}_pr_url" path: "${{ inputs.cluster }}_pr_url.txt" - name: Approve the PR - if: ${{ inputs.is_staging == true }} + if: ${{ steps.commit-and-push.outputs.committed == 'true' && inputs.is_staging == true }} run: gh pr review --approve env: GH_TOKEN: ${{ secrets.TOKEN_GITHUB_YENKINS_ADMIN}} diff --git a/.github/workflows/create-pr-comment.yaml b/.github/workflows/create-pr-comment.yaml index ee74af51f..dff38067a 100644 --- a/.github/workflows/create-pr-comment.yaml +++ b/.github/workflows/create-pr-comment.yaml @@ -76,14 +76,19 @@ jobs: cat "$comment_file" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT else - pr_url=${{ inputs.deployment_pr_url }} + pr_url="${{ inputs.deployment_pr_url }}" - pr_comment=":exclamation: **THIS PULL REQUEST WILL NEED TO BE DELIVERED MANUALLY** :exclamation: - :exclamation: *REVERT following gitops-deployments PR bellow to rollback this change* :exclamation: - * PR for **all clusters** :arrow_right:: ${pr_url} + if [[ -z "$pr_url" ]]; then + pr_comment=":information_source: **NO PRODUCTION DELIVERY NEEDED** + The production HelmReleases already match the built chart and images, so no gitops-deployments PR was opened." + else + pr_comment=":exclamation: **THIS PULL REQUEST WILL NEED TO BE DELIVERED MANUALLY** :exclamation: + :exclamation: *REVERT following gitops-deployments PR bellow to rollback this change* :exclamation: + * PR for **all clusters** :arrow_right:: ${pr_url} - :warning: Pushing another change before rolling out this change might cause confliction in [gitops-deployments](https://github.com/gooddata/gitops-deployments) repo - :point_right: Merging progress will be informed in [#cd-pipelines-release-prod](https://app.slack.com/client/T02G0PHRH/C0504DF292T) slack channel" + :warning: Pushing another change before rolling out this change might cause confliction in [gitops-deployments](https://github.com/gooddata/gitops-deployments) repo + :point_right: Merging progress will be informed in [#cd-pipelines-release-prod](https://app.slack.com/client/T02G0PHRH/C0504DF292T) slack channel" + fi echo "pr_comment<> $GITHUB_OUTPUT echo "$pr_comment" >> $GITHUB_OUTPUT diff --git a/.github/workflows/lcm-pipeline.yaml b/.github/workflows/lcm-pipeline.yaml index f52f19c83..9ca42eec7 100644 --- a/.github/workflows/lcm-pipeline.yaml +++ b/.github/workflows/lcm-pipeline.yaml @@ -259,6 +259,7 @@ jobs: needs.wait-for-deployment.result == 'failure' || needs.lcm-integration-e2e.result == 'failure' ) && + needs.create-staging-pr.outputs.commit_hash != '' && inputs.deploy uses: ./.github/workflows/revert-staging-pr.yaml with: