Skip to content

ZXF: [Node] Deploy Integration Network Release #1264

ZXF: [Node] Deploy Integration Network Release

ZXF: [Node] Deploy Integration Network Release #1264

# SPDX-License-Identifier: Apache-2.0
name: "ZXF: [Node] Deploy Integration Network Release"
on:
workflow_dispatch:
permissions:
contents: read
jobs:
### The Jenkins workflow is only accepting integration deployments from the main branch where the ref is `refs/heads/main`.
### Therefore, we have hardcoded the ref to `refs/heads/main` in the checkout step and the payload sent to Jenkins.
integration-deploy:
name: Integration / Deploy Artifact
runs-on: hl-cn-default-lin-sm
if: ${{ !github.event.workflow_dispatch.repository.fork }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Check out code at the specified ref
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: refs/heads/main
- name: Gather commit info
id: gather-commit-info
run: |
# Fetch info from the most recent commit for the given ref
COMMIT_AUTHOR="$(git log -1 --pretty=format:'%an')"
COMMIT_MSG="$(git log -1 --pretty=format:'%s')"
COMMIT_SHA="$(git rev-parse HEAD)"
# Print them to the console
echo "Commit Author: ${COMMIT_AUTHOR}"
echo "Commit Message: ${COMMIT_MSG}"
echo "Commit SHA: ${COMMIT_SHA}"
# Expose them as outputs for the next steps
echo "author=${COMMIT_AUTHOR}" >> "${GITHUB_OUTPUT}"
echo "msg=${COMMIT_MSG}" >> "${GITHUB_OUTPUT}"
echo "sha=${COMMIT_SHA}" >> "${GITHUB_OUTPUT}"
- name: Notify Jenkins of Release (Integration)
id: jenkins-integration
uses: fjogeleit/http-request-action@23ad54bcd1178fcff6a0d17538fa09de3a7f0a4d # v1.16.4
with:
url: ${{ secrets.RELEASE_JENKINS_INTEGRATION_URL }}
data: |
{
"ref": "refs/heads/main",
"author": "${{ steps.gather-commit-info.outputs.author }}",
"msg": "${{ steps.gather-commit-info.outputs.msg }}",
"sha": "${{ steps.gather-commit-info.outputs.sha }}"
}
- name: Display Jenkins Payload
env:
JSON_RESPONSE: ${{ steps.jenkins-integration.outputs.response }}
run: |
jq '.' <<<"${JSON_RESPONSE}"
printf "### Jenkins Response Payload\n\`\`\`json\n%s\n\`\`\`\n" "$(jq '.' <<<"${JSON_RESPONSE}")" >>"${GITHUB_STEP_SUMMARY}"
- name: Check for Jenkins Failures (Integration)
env:
JSON_RESPONSE: ${{ steps.jenkins-integration.outputs.response }}
run: |
INTEGRATION_TRIGGERED="$(jq '.jobs."build-upgrade-integration".triggered' <<<"${JSON_RESPONSE}")"
DOCKER_TRIGGERED="$(jq '.jobs."build-upgrade-integration-docker".triggered' <<<"${JSON_RESPONSE}")"
if [[ "${INTEGRATION_TRIGGERED}" != true ]]; then
echo "::error title=Jenkins Trigger Failure::Failed to trigger the 'build-upgrade-integration' job via the Jenkins 'integration' pipeline!"
exit 1
fi
if [[ "${DOCKER_TRIGGERED}" != true ]]; then
echo "::error title=Jenkins Trigger Failure::Failed to trigger the 'build-upgrade-integration-docker' job via the Jenkins 'integration' pipeline!"
exit 1
fi