Hello, GoCD doesn't allow uploading a file as part of trigger of a pipeline. You can try to model your pipelines in any of the following ways -
1. Have that JSON file checked-in as part of a repository (Git / SVN etc.) and have that has one of the material in the pipeline. 2. Assuming that JSON file is available on a storage system (like S3) or accessible via an URL, you can fetch the JSON file as the first task in the job and use that for rest of the tasks within the job. Note: If your pipeline has multiple jobs (across/within stages) you need to do this once for every job. 3. You can also use the second approach you've said, wherein you can expose that file as an artifact from a stage and use it across other stages of the same pipeline or different pipelines. Note - This approach wouldn't work if you've multiple jobs in a single stage, since they would all run in parallel. BTW you can use the UI or the Trigger Pipeline API for any of the above approaches. AFAIK, you can't use the Create Artifact API call for the current (read as active) pipeline run (GoCD core team members correct me if I'm wrong), since the artifacts for a pipeline before completion isn't accessible anyways. HTH On Wed, Apr 5, 2017 at 4:20 PM, <[email protected]> wrote: > I'm using the API to trigger a pipeline. > I'd like pass a (json) file which contains an arbitrary (variable) number > of parameters to the pipeline and then process this file in the pipeline. > I'm thinking that the most appropriate way would be to upload the json > file as an artifact (also via the API). > > Could anyone please explain the proper flow and API calls required to > achieve this? > > 1. Do I need to trigger the pipeline and call "Create Artifact" > immediately after? Does the pipeline need to be running for the create > artifact api to work? > > > 2. How can I make sure that the execution of the pipeline continues only > after the artifact is loaded? > > Some ideas I have: > Use a manual stage? - stage 1 will stop and I'll create the artifact. > Stage 2 is manual. After the artifact is loaded, I'd need to somehow > release stage 2 via API, but I'm not sure this can be done. > > Or, should I do something similar but with two pipelines instead of stages? > Pipeline 1: does nothing, after being triggered it will stop and I'll > create the artifact in it > Pipeline2 (downstream): after the artifact is loaded, trigger this > pipeline (via API) which will then fetch the artifact and process it. > > > -- > You received this message because you are subscribed to the Google Groups > "go-cd" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Ashwanth Kumar / ashwanthkumar.in -- You received this message because you are subscribed to the Google Groups "go-cd" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
