flux-ci icon indicating copy to clipboard operation
flux-ci copied to clipboard

Trigger using HTTP request

Open gsantner opened this issue 6 years ago • 4 comments

Currently flux ci misses support for triggering using HTTP requests (not using Git service - but manually e.g. using curl)

Here are two examples I know, and would be great if we are mostly compatible:

  • GitLab: curl --request POST "https://<IP_DOMAIN>/api/v4/projects/<PROJECT>/trigger/pipeline?token=<TOKEN_FROM_PROJECT_SETTING>&ref=<BRANCH_COMMIT_OR_TAG>&variables[build_docs]=1&variables[deployment_env]=testing&variables[sdk_version]=2.16" (Basic docs)
  • Jenkins: curl "https://<IP_DOMAIN>/job/<PROJECT>/buildWithParameters?token=<TOKEN_FROM_PROJECT_SETTING>&ref=<BRANCH>&build_docs=1&deployment_env=testing&sdk_version=4.1-beta

The goal would be to basically support those two styles of passing vars.

  • With ref and token always being special use for us in ci
  • All other vars as environment variable - with variable setting variable[something]=value working the same as something=value would have been specified

Thought: maybe something like https://mylux.ci/api/trigger/FLUXCI_USER/FLUXCI_PROJECT/pipeline?token=something ?

Return body could be json with ok/success flag and new pipeline-id.

This is specially getting interesting when one wants to trigger e.g. a release build for an application, but wants to specify some values.

I'm have not worked with any rest framework in python yet. maybe this is not too hard, dont know.

gsantner avatar Jun 09 '18 17:06 gsantner

I do understand correctly that this would be basically the same as starting a new build via the Web Interface, only that you can specify some environment variables as well?

We should also get the ability to specify environment variables with the "New Build" option in the web as well.

NiklasRosenstein avatar Jun 09 '18 17:06 NiklasRosenstein

Yes, exactly. If user has the ability too on webui even better. Than we could already call API with given parameters instead of calling python methods.

The other thing - At ci-file level I have already implemented support for parsing things from file, but those are thought to be more or less fixed values you dont change often :D.

gsantner avatar Jun 09 '18 17:06 gsantner

I can give some ideas or feedback from what I know of GL and jenkins CI 's trigger API and Web-Trigger-View if something needed

gsantner avatar Jun 09 '18 17:06 gsantner

related to decisions of #49 too

gsantner avatar Jun 09 '18 18:06 gsantner