I wish to integrate Zenhub tagging into our pipeline, by running the travis pipeine only if the PR has a zenhub tag attached to it.
I wish to exclude running various stages unless an environment variable is set
jobs:
include:
- stage: test
if: env(ZENHUB_PR_TAG)="PR:READY"
name: 'Build + Lint + Unit Tests'
The problem is, this ZENHUB_PR_TAG variable is dynamic, and needs to be set by hitting the Zenhub API.
Is there anyway I can run a script to initialise my environment variables before running any of the jobs?
I’ve tried adding a before_install
step outside the job matrix
before_install:
- source ./travis/zenhub.sh # This sets ZENHUB_PR_TAG
jobs:
include:
- stage: test
if: env(ZENHUB_PR_TAG)="PR:READY"
name: 'Build + Lint + Unit Tests'
But my build is not run,
The only way I can get this job to run , is to hardcode
env:
- ZENHUB_PR_TAG="PR:READY"