V2 api - Pass git sha to "trigger new pipeline"

Hello,

I’m wondering if it’s possible to pass the git sha in the new v2 api like you could in v1 with the --data revision=$CIRCLE_SHA1 when triggering a workflow instead of it grabbing HEAD of that branch.

The idea is that if we are calling a workflow for our deploy steps (for insights reasons) up through environments, we want to make sure we are calling the same SHA and not mid-way through grabbing the latest commit and pushing something that has not been tested in lower environments.

Hello @jtprom, and welcome to the CircleCI community!

You can actually use the tag parameter to build a specific commit. However, you’ll need to ensure that the config.yml contained in said commit includes filters to build tags.

By default , CircleCI will build for all branches, but won’t build for any tag.

So you’ll need to add the following filter to the jobs/workflows you want to run when you trigger the pipeline via the CircleCI API with the commit SHA as the tag:

filters:
  tags:
    only: /.*/

For more information on how to execute jobs/workflows for a git tag, please see our documentation.

Let me know if this helps.

(Edit: Fixing typos)

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.