-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
8 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 |
---|---|---|
@@ -1,26 +1,49 @@ | ||
# This is a workflow that is manually triggered to deploy given crabserver tag to given k8s host | ||
# This workflow can be used to deploy crabserver to provided environment. | ||
# workflow requires to enter 2 input parameters: TAG and ENVIRONMENT (allowed values: test2, preprod, prod) | ||
#Workflow consists of 2 jobs: | ||
# 1. get-host: job set-up host where crabserver should be deployed, | ||
# e.g. if environment is set to 'preprod', crabserver is deployed to 'cmsweb-testbed.cern.ch' | ||
# 2. deploy: job callS a remote webhook endpoint with a JSON payload. | ||
# Read more at: https://github.com/marketplace/actions/workflow-webhook-action | ||
|
||
name: CRABServer deployment | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'CRABServer tag to deploy:' | ||
description: 'TAG:' | ||
required: true | ||
environment: | ||
description: 'ENVIRONMENT:' | ||
required: true | ||
hostName: | ||
description: 'Host where given tag should be deployed:' | ||
required: true | ||
default: preprod | ||
|
||
jobs: | ||
greet: | ||
get-host: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
hostName: ${{ steps.get_environment.outputs.hostName }} | ||
steps: | ||
- id: get_environment | ||
run: | | ||
if [ "${{ github.event.inputs.environment }}" = "test2" ] | ||
then | ||
echo "::set-output name=hostName::cmsweb-test2.cern.ch" | ||
elif [ "${{ github.event.inputs.environment }}" = "preprod" ] | ||
then | ||
echo "::set-output name=hostName::cmsweb-testbed.cern.ch" | ||
else | ||
exit 1 | ||
fi | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [get-host] | ||
steps: | ||
- name: Invoke crabserver deployment | ||
uses: distributhor/workflow-webhook@v1 | ||
env: | ||
webhook_url: ${{ secrets.WEBHOOK_URL }} | ||
webhook_secret: ${{ secrets.WEBHOOK_SECRET }} | ||
data: '{ "test1": "test1", "test2" : "test2" }' | ||
|
||
data: '{ "hostName": "${{ needs.get-host.outputs.hostName }}", "tag" : "${{ github.event.inputs.tag }}" }' |