Skip to content

Commit

Permalink
Fix workflow fails if job is not submitted (#10)
Browse files Browse the repository at this point in the history
Changes:
 - 'export' was succeeding, so the workflow passed. Now separates to two
   steps which should fail properly.
 - Add failing test
  • Loading branch information
adamrtalbot authored May 12, 2023
1 parent c017ff2 commit b6580c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ jobs:
| 😎 Workflow URL | ${{ steps.runs.outputs.workflowUrl }} |
comment_tag: towerrun
if: github.event_name == 'pull_request'

- uses: ./
id: runfails
continue-on-error: true
with:
pipeline: no_pipeline_exists
revision: master
workspace_id: ${{ secrets.TOWER_WORKSPACE_ID }}
access_token: ${{ secrets.TOWER_ACCESS_TOKEN }}
compute_env: ${{ secrets.TOWER_COMPUTE_ENV }}
run_name: ${{ github.job }}_${{ github.sha }}
workdir: ${{ secrets.AWS_S3_BUCKET }}/work/${{ github.sha }}

- name: Check Failure
if: steps.runfails.outcome == 'success'
run: |
echo "Failed to catch invalid pipeline submission: ${{ steps.runfails.outcome }}"
exit 1
- uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if [ "$WAIT" = false ]; then unset WAIT; fi

# Launch the pipeline
# We use capture the JSON as variable $OUT. We encode it as base64 to get around Github secrets filters but we still mask it anyway to make sure the details don't leak.
export OUT=$(tw -o json -v \
OUT=$(tw -o json -v \
launch \
$PIPELINE \
--params-file=params.json \
Expand All @@ -45,7 +45,7 @@ export OUT=$(tw -o json -v \
${PRE_RUN_SCRIPT:+"--pre-run=pre_run.sh"} \
${NEXTFLOW_CONFIG:+"--config=nextflow.config"} \
${WAIT:+"--wait=$WAIT"} \
2>> $LOG_FN | tee -a $LOG_FN | base64 -w 0)
2>> $LOG_FN | base64 -w 0)

# Base64 decode and extract specific value for output
export workflowId=$(echo $OUT | base64 -d | jq -r '.workflowId')
Expand Down

0 comments on commit b6580c8

Please sign in to comment.