Skip to content

Commit

Permalink
ci: enable triggering specific workflows via "Trigger Pipeline" button
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastian Krol committed Feb 22, 2023
1 parent 6717745 commit 8730dc7
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

version: 2.1

parameters:
workflow:
type: string
default: build

shared: &shared
working_directory: ~/repo

Expand Down Expand Up @@ -504,12 +509,20 @@ workflows:
version: 2

build:

when:
# This makes sure none of our triggers (https://app.circleci.com/settings/project/github/instana/nodejs/triggers)
# kicks off the main build workflow jobs. (These jobs are triggered by webhook, that is, by pushing commits to
# Github branches for which a PR has been opened.)
not:
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
and:

# This makes sure the "Trigger Pipeline" button when started with a specific workflow parameter value
# (say, "coverage) does not also start the "build" workflow.
- equal: [ build, << pipeline.parameters.workflow >> ]

# This makes sure that none of our triggers
# (https://app.circleci.com/settings/project/github/instana/nodejs/triggers)
# kicks off the main build workflow jobs. (This workflow is triggered by the source "webhook", that is, by
# pushing commits to Github branches for which a PR has been opened.)
- not:
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
jobs:
- "node-18"
- "node-16"
Expand All @@ -519,8 +532,9 @@ workflows:
or:
# See https://app.circleci.com/settings/project/github/instana/nodejs/triggers.
- equal: [ nightly-build-2-am, << pipeline.schedule.name >> ]
# This allows us to kick off this workflow on demand via the API.
- equal: [ api, << pipeline.trigger_source >> ]
# This allows us to kick off this workflow on demand via the CircleCI UI with the "Trigger Pipeline" button,
# by providing the parameter "workflow: legacy-nodejs-versions"
- equal: [ legacy-nodejs-versions, << pipeline.parameters.workflow >> ]
jobs:
- "node-14"
- "node-12"
Expand All @@ -531,8 +545,9 @@ workflows:
or:
# See https://app.circleci.com/settings/project/github/instana/nodejs/triggers.
- equal: [ nightly-build-4-am, << pipeline.schedule.name >> ]
# This allows us to kick off this workflow on demand via the API.
- equal: [ api, << pipeline.trigger_source >> ]
# This allows us to kick off this workflow on demand via the CircleCI UI with the "Trigger Pipeline" button,
# by providing the parameter "workflow: esm-build"
- equal: [ esm-build, << pipeline.parameters.workflow >> ]
jobs:
- "node-18-esm"
- "node-16-esm"
Expand All @@ -542,7 +557,8 @@ workflows:
or:
# See https://app.circleci.com/settings/project/github/instana/nodejs/triggers.
- equal: [ weekly-build-sunday-0-am, << pipeline.schedule.name >> ]
# This allows us to kick off this workflow on demand via the API.
- equal: [ api, << pipeline.trigger_source >> ]
# This allows us to kick off this workflow on demand via the CircleCI UI with the "Trigger Pipeline" button,
# by providing the parameter "workflow: coverage"
- equal: [ coverage, << pipeline.parameters.workflow >> ]
jobs:
- "node-coverage"

0 comments on commit 8730dc7

Please sign in to comment.