How to select parameter values at run time(at the time of triggering the pipeline)

Query: In CircleCi, how to select parameter values at run time(at the time of triggering the pipeline)

For instance, in Jenkins at the time of building the job, can select parameter values. Suppose I have choice parameter “Browser” with values “Chrome, Firefox, Edge, Safari”. At the time of building the job, using Build with Parameters option I can choose either chrome/Firefox/Edge/Safari.
image
Is CircleCI provides above mentioned feature/functionality(select parameter values at the time of triggering the pipeline)?

Thanks In Advance.

Hi @ramakrishnareddysatt – welcome to Discuss!

At the moment we don’t have this option via the UI – however, it can be accomplished by setting these parameters as “Pipeline Parameters” and then triggering the build via the API and passing the appropriate values.

We have details on accomplishing that in our pipeline parameters documentation.

If helpful, as an example like your screenshot, it would look like this:

curl --location --request POST 'https://circleci.com/api/v2/project/github/<ORG>/<PROJECT>/pipeline' \
--header 'Content-Type: application/json' \
-u '<API_KEY>:' \
--data-raw '{
  "branch": "main",
    "parameters": {
    	"BROWSER": "Chrome",
    	"OS": "OS_X" 
  }
}'

You would just need to generate and utilize a personal API token and then replace the <ORG> and <PROJECT> with the appropriate values for your org/repo.

Beyond the above we also have an existing feature request for implementing this via the UI, you can add your vote on that request and you will be notified automatically of any updates.

Hope that helps!

Hello @nbialostosky
Instead of personal API token, can i use project API token to trigger another project pipeline via the API?

use case: currently we have couple of upstream projects(xyz, abc … etc.) and all these upstream projects trigger same downstream project to generate reports. Here instead of personal API token, Can i use project API token so that downstream project knows which upstream project(xyz/abc) trigger the build via the API?

Hi @ramakrishnareddysatt,

Thanks for the reply and good question! Unfortunately though, the project-level API tokens cannot be utilized to generate a new pipeline. This is because we need to associate the pipeline with the actual ‘user’ who triggered it. Even if you end up creating a bot user to do these actions, they still need to be tied to a user instead of a project.

If you needed to verify which project triggered the downstream report you may be able to instead pass a variable or another parameter (especially if you are doing the API trigger upstream).

Hope that helps clarify!

Hey @ramakrishnareddysatt you can try use the tool i built for this.

https://beta.swissknife.dev Once you login you can create and run pipelines with custom params. Let me know if you have any feature requests :slight_smile:

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