Is there a way to alter Legacy "Environment Variables" through api

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 "${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}" \

Hi @Looooopy ,

If you wish to add an env var in your pipeline steps, the best approach would be to update the pipeline and add in the env vars into the updated pipeline.

First, you would have to construct the new pipeline steps where you would use the new env var within the build. Then, you would pass in the newly constructed pipeline steps and pass it as the new steps configuration when calling the Update Pipeline API.