This is the next step to get my pipelines to redeploy to another cluster i need to set an environment variable here through some api, is there an option or do i have to do it through the GUI on Buildkite?
Sure i can hack a login and do it through the standard web ui, but i want it to be more robust, which involves the TOKEN instead of a login session.
This is not something I would’t like to do but it’s a solution until i know if there is some api that does the same thing.
update_pipeline_env() {
local project="${1:?'A project must be provided'}"
local org_slug="${2:?'A org must be provided'}"
local env="${3:?'An env must be provided'}"
curl "https://buildkite.com/${org_slug}/${project}/steps" \
-H 'content-type: application/x-www-form-urlencoded' \
-H "cookie: ${BUILDKITE_COOKIE}" \
--data-urlencode "authenticity_token=${BUILDKITE_AUTHENTICITY_TOKEN}" \
--data-urlencode '_method=patch' \
--data-urlencode 'commit=Save+Steps' \
--data-urlencode "project[env]=${env}" \
}