Skip to content

Commit

Permalink
improve deployment job
Browse files Browse the repository at this point in the history
  • Loading branch information
ddaina authored Mar 9, 2021
1 parent 2c8089f commit afab4af
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions .github/workflows/crabserverDeployment.yml
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 }}" }'

0 comments on commit afab4af

Please sign in to comment.