Serverless: Promote to QA #1
This file contains 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
--- | |
# - This workflow creates a tag with the format "deploy@<timestamp>" on the main branch. | |
# - It is triggered manually from the GitHub Actions UI. | |
# - It is only allowed to run on the main branch and ensures that the tag is created | |
# on the main branch only in a verification step. | |
# This is only to prevent accidental creation of the tag on other branches and cannot be used to prevent malicious creation of the tag. | |
name: "Serverless: Promote to QA" | |
on: | |
workflow_dispatch: | |
inputs: | |
commit: | |
description: "Commit to promote (default: latest commit on main)" | |
concurrency: | |
group: ${{ github.workflow }} | |
jobs: | |
create-deploy-tag: | |
# Temporary, we need a way to limit this to a GitHub team instead of specific users | |
if: contains('["watson","clintandrewhall","kobelb","lukeelmers","thomasneirynck","jbudz","mistic","delanni","Ikuni17"]', github.triggering_actor) | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Select commit to be tagged | |
run: | | |
commit="${{ github.event.inputs.commit || github.sha }}" | |
echo "COMMIT=${commit}" >> "${GITHUB_ENV}" | |
- name: Verify selected or newer commit isn't already tagged | |
run: | | |
git tag --contains ${COMMIT} | grep -P "^deploy@\d+$" && { | |
echo "A deploy-tag already exists on the selected or newer commit!" | |
exit 1 | |
} || true | |
- name: Verify branch | |
run: | | |
if [[ "${GITHUB_REF}" != "refs/heads/main" ]]; then | |
echo "This workflow can only be run on the main branch" | |
exit 1 | |
fi | |
- name: Prepare tag | |
run: | | |
tag_name="deploy@$(date +%s)" | |
echo "TAG_NAME=${tag_name}" >> "${GITHUB_ENV}" | |
- name: Create tag | |
run: | | |
git tag ${TAG_NAME} ${COMMIT} | |
git push origin "refs/tags/${TAG_NAME}" | |
- name: Post Slack success message | |
if: success() | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Promotion of a new <https://github.com/elastic/kibana/commit/${{ env.COMMIT }}|commit> to QA has been initiated 🎉\n\nOnce promotion is complete, please begin any required manual testing.\n\n*Remember:* Promotion to Staging is currently a manual process and will proceed once the build is signed off in QA." | |
} | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Initiated by:*\n<https://github.com/${{ github.triggering_actor }}|${{ github.triggering_actor }}>" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Commit:*\n<https://github.com/elastic/kibana/commit/${{ env.COMMIT }}|${{ env.COMMIT }}>" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Git tag:*\n<https://github.com/elastic/kibana/releases/tag/${{ env.TAG_NAME }}|${{ env.TAG_NAME }}>" | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Expected Staging promotion date:" | |
}, | |
"accessory": { | |
"type": "datepicker", | |
"placeholder": { | |
"type": "plain_text", | |
"text": "Select a date", | |
"emoji": true | |
}, | |
"action_id": "datepicker-action" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Useful links:*\n\n • <https://docs.google.com/document/d/1c2LzojDh1wawjeMsKh4D_L2jpVJALhxukkmmL-TUbrs/edit#heading=h.50173f90utwr|Release process playbook>\n • <https://github.com/elastic/kibana/actions/runs/${{ github.run_id }}|GitHub Workflow run>\n • <https://buildkite.com/elastic/kibana-tests/builds?branch=main|Quality Gate pipeline>\n • <https://argo-workflows.us-central1.gcp.qa.cld.elstc.co/workflows?label=hash%3D${{ env.COMMIT }}|Argo Workflow>\n • <https://platform-logging.kb.us-central1.gcp.foundit.no/app/dashboards#/view/f710d7d0-00b9-11ee-93d2-8df4bca5a4c9?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1d,to:now))&service-name=kibana&_a=(controlGroupInput:(chainingSystem:HIERARCHICAL,controlStyle:oneLine,ignoreParentSettings:(ignoreFilters:!f,ignoreQuery:!f,ignoreTimerange:!f,ignoreValidations:!f),panels:('18201b8e-3aae-4459-947d-21e007b6a3a5':(explicitInput:(dataViewId:'logs-*',enhancements:(),fieldName:commit-hash,id:'18201b8e-3aae-4459-947d-21e007b6a3a5',selectedOptions:!('${{ env.COMMIT }}'),title:commit-hash),grow:!t,order:1,type:optionsListControl,width:medium),'41060e65-ce4c-414e-b8cf-492ccb19245f':(explicitInput:(dataViewId:'logs-*',enhancements:(),fieldName:service-name,id:'41060e65-ce4c-414e-b8cf-492ccb19245f',selectedOptions:!(kibana),title:service-name),grow:!t,order:0,type:optionsListControl,width:medium),ed96828e-efe9-43ad-be3f-0e04218f79af:(explicitInput:(dataViewId:'logs-*',enhancements:(),fieldName:to-env,id:ed96828e-efe9-43ad-be3f-0e04218f79af,selectedOptions:!(qa),title:to-env),grow:!t,order:2,type:optionsListControl,width:medium))))|GPCTL Logs dashboard>" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Day 1 to-do list*" | |
}, | |
"accessory": { | |
"type": "checkboxes", | |
"options": [ | |
{ | |
"text": { | |
"type": "mrkdwn", | |
"text": "Verify successful promotion to QA" | |
}, | |
"value": "value-0" | |
}, | |
{ | |
"text": { | |
"type": "mrkdwn", | |
"text": "Notify Security Solution team to beging manual testing" | |
}, | |
"value": "value-1" | |
} | |
], | |
"action_id": "checkboxes-action" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.DEPLOY_TAGGER_SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
- name: Post Slack failure message | |
if: failure() | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Creation of deploy tag on <https://github.com/elastic/kibana/commit/${{ env.COMMIT }}|commit> failed ⛔️" | |
} | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Initiated by:*\n<https://github.com/${{ github.triggering_actor }}|${{ github.triggering_actor }}>" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Commit:*\n<https://github.com/elastic/kibana/commit/${{ env.COMMIT }}|${{ env.COMMIT }}>" | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Useful links:*\n\n • <https://docs.google.com/document/d/1c2LzojDh1wawjeMsKh4D_L2jpVJALhxukkmmL-TUbrs/edit#heading=h.50173f90utwr|Release process playbook>\n • <https://github.com/elastic/kibana/actions/runs/${{ github.run_id }}|GitHub Workflow run>" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.DEPLOY_TAGGER_SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |