-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to trigger-jenkins-job action
- Loading branch information
1 parent
22a586c
commit c15eaff
Showing
2 changed files
with
185 additions
and
149 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,23 @@ description: | | |
envInputs: | ||
JENKINS_USER: Jenkins user | ||
JENKINS_BUILD_TOKEN: Jenkins build token. Keep in mind that tokens for `temploy` and `staging` differ | ||
PROXY: Proxy to use for Jenkins | ||
inputs: | ||
token: | ||
# token: | ||
# required: true | ||
# description: 'GitHub token to create a deployment' | ||
jenkins_build_url: | ||
description: 'Jenkins build instance URL' | ||
required: true | ||
jenkins_build_user: | ||
description: 'Jenkins build user' | ||
required: true | ||
jenkins_build_token: | ||
description: 'Jenkins build token' | ||
required: true | ||
jenkins_sa_credentials: | ||
description: 'Jenkins service account credentials to use with IAP' | ||
required: true | ||
description: 'GitHub token to create a deployment' | ||
environment-url: | ||
required: false | ||
description: 'URL of the environment' | ||
|
@@ -30,64 +41,65 @@ inputs: | |
default: 'false' | ||
description: Creates a Github Deployment along with JIRA Deployment | ||
|
||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: chrnorm/deployment-action@v2 | ||
name: Create GitHub deployment | ||
id: gh-deployment | ||
if: ${{ always() && inputs.create-gh-deployment == 'true' }} | ||
with: | ||
token: ${{ inputs.token }} | ||
environment-url: ${{ inputs.environment-url }} | ||
environment: ${{ inputs.environment }} | ||
transient-environment: ${{ inputs.transient-environment }} | ||
auto-inactive: ${{ inputs.auto-inactive }} | ||
# - uses: chrnorm/deployment-action@v2 | ||
# name: Create GitHub deployment | ||
# id: gh-deployment | ||
# if: ${{ always() && inputs.create-gh-deployment == 'true' }} | ||
# with: | ||
# token: ${{ inputs.token }} | ||
# environment-url: ${{ inputs.environment-url }} | ||
# environment: ${{ inputs.environment }} | ||
# transient-environment: ${{ inputs.transient-environment }} | ||
# auto-inactive: ${{ inputs.auto-inactive }} | ||
|
||
- name: Update deployment status on success | ||
if: ${{ success() && inputs.create-gh-deployment == 'true' }} | ||
uses: chrnorm/deployment-status@v2 | ||
with: | ||
token: ${{ inputs.token }} | ||
environment-url: ${{ steps.gh-deployment.outputs.environment_url }} | ||
deployment-id: ${{ steps.gh-deployment.outputs.deployment_id }} | ||
log-url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
state: 'success' | ||
# - name: Update deployment status on success | ||
# if: ${{ success() && inputs.create-gh-deployment == 'true' }} | ||
# uses: chrnorm/deployment-status@v2 | ||
# with: | ||
# token: ${{ inputs.token }} | ||
# environment-url: ${{ steps.gh-deployment.outputs.environment_url }} | ||
# deployment-id: ${{ steps.gh-deployment.outputs.deployment_id }} | ||
# log-url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
# state: 'success' | ||
|
||
- name: Update deployment status on failure | ||
if: ${{ failure() && inputs.create-gh-deployment == 'true' }} | ||
uses: chrnorm/deployment-status@v2 | ||
with: | ||
token: ${{ inputs.token }} | ||
environment-url: ${{ steps.gh-deployment.outputs.environment_url }} | ||
deployment-id: ${{ steps.gh-deployment.outputs.deployment_id }} | ||
log-url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
state: 'failure' | ||
# - name: Update deployment status on failure | ||
# if: ${{ failure() && inputs.create-gh-deployment == 'true' }} | ||
# uses: chrnorm/deployment-status@v2 | ||
# with: | ||
# token: ${{ inputs.token }} | ||
# environment-url: ${{ steps.gh-deployment.outputs.environment_url }} | ||
# deployment-id: ${{ steps.gh-deployment.outputs.deployment_id }} | ||
# log-url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
# state: 'failure' | ||
|
||
- name: Set appName | ||
id: repo | ||
if: ${{ always() }} | ||
shell: bash | ||
run: | | ||
echo APP_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2) >> $GITHUB_OUTPUT | ||
# - name: Set appName | ||
# id: repo | ||
# if: ${{ always() }} | ||
# shell: bash | ||
# run: | | ||
# echo APP_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2) >> $GITHUB_OUTPUT | ||
|
||
- id: sha | ||
uses: toptal/davinci-github-actions/get-workflow-sha@master | ||
# - id: sha | ||
# uses: toptal/davinci-github-actions/get-workflow-sha@master | ||
|
||
- name: Trigger `Create JIRA` deployment | ||
uses: toptal/jenkins-job[email protected] | ||
uses: toptal/actions/trigger-jenkins-job@main | ||
if: ${{ always() }} | ||
with: | ||
jenkins_url: https://jenkins-build.toptal.net/ | ||
jenkins_user: ${{ env.JENKINS_USER }} | ||
jenkins_token: ${{ env.JENKINS_BUILD_TOKEN }} | ||
proxy: ${{ env.PROXY }} | ||
job_name: create-jira-deployment | ||
job_params: | | ||
{ | ||
"appName": "${{ steps.repo.outputs.APP_NAME }}", | ||
"envName": "${{ inputs.environment }}", | ||
"sha": "${{ github.event.pull_request.head.sha || steps.sha.outputs.result }}" | ||
} | ||
jenkins_url: ${{ inputs.jenkins_build_url }} | ||
jenkins_user: ${{ inputs.jenkins_build_user }} | ||
jenkins_token: ${{ inputs.jenkins_build_token }} | ||
jenkins_client_id: ${{ inputs.jenkins_client_id }} | ||
jenkins_sa_credentials: ${{ inputs.jenkins_sa_credentials }} | ||
# job_name: create-jira-deployment | ||
# job_params: | | ||
# { | ||
# "appName": "${{ steps.repo.outputs.APP_NAME }}", | ||
# "envName": "${{ inputs.environment }}", | ||
# "sha": "${{ github.event.pull_request.head.sha || steps.sha.outputs.result }}" | ||
# } | ||
job_name: job-test-iap | ||
job_timeout: '3600' |
Oops, something went wrong.