Convert to YAML steps + read steps from repo

I was originally using the web-based step UI, then later I used the ‘Convert to YAML steps’ button. Now I realize that the yaml content should really be under source control. I’ve created a .buildkite/pipeline.yml file from the current steps, how do I cut over to using it? All the doc talks about adding the ‘read steps from repo’ step, but…as I used the convert button, I no longer have the step UI available.

Is there a way forward, or do I need to nuke the pipeline and start over?

Thanks…

Great question, and sorry we don’t make that clear in our docs or UI yet.

If you copy and paste it into the YAML file in your source control, you can then update the steps in your pipeline settings to be something like this:

steps:
  - command: “buildkite-agent pipeline upload”
    label: “:pipeline:”

cc @harriet

Thanks for the response!!

Unfortunately, using those steps does not work for me:

[2019-07-17T13:26:03Z] $ /bin/bash -e -c ““buildkite-agent pipeline upload””
[2019-07-17T13:26:03Z] /bin/bash: “buildkite-agent: command not found
[2019-07-17T13:26:03Z] # ↳ Command completed in 2.02011ms
[2019-07-17T13:26:03Z] :rotating_light: Error: The command exited with status 127

…which is odd, since earlier in the log shows it making other successful calls to buildkite-agent, such as:

[2019-07-17T13:33:09Z] # Checking to see if Git data needs to be sent to Buildkite
[2019-07-17T13:33:09Z] $ buildkite-agent meta-data exists buildkite:git:commit
[2019-07-17T13:33:09Z] 2019-07-17 13:33:09 DEBUG POST https://agent.buildkite.com/v3/jobs/e58a4ca3-a2aa-4d4b-b8f7-243b264c7123/data/exists
[2019-07-17T13:33:09Z] 2019-07-17 13:33:09 DEBUG ↳ POST https://agent.buildkite.com/v3/jobs/e58a4ca3-a2aa-4d4b-b8f7-243b264c7123/data/exists proto=HTTP/2.0 status=200 Δ=444.149447ms
[2019-07-17T13:33:09Z] # ↳ Command completed in 449.712295ms
[2019-07-17T13:33:09Z] # Sending Git commit information back to Buildkite

I’d assume bash would inherit the current environment, including path…

Thanks for the log output, and that’s super strange it’s not working.

Could you replace it with the following, and see what it outputs?

steps:
  - command: "echo $$PATH"
    label: ":pipeline:"

Sure:

[2019-07-17T13:57:56Z] $ /bin/bash -e -c “echo $PATH”
[2019-07-17T13:57:56Z] /usr/local/ansible-venv/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/sonar-scanner/bin
[2019-07-17T13:57:56Z] # ↳ Command completed in 1.248303ms

…that said, we have a bunch of agents, and I can’t guarantee this ran on the same agent as the previous run.

Ah! is it complaining about the quotes perhaps?

  • command: “buildkite-agent pipeline upload”

[2019-07-17T13:26:03Z] $ /bin/bash -e -c ““buildkite-agent pipeline upload””
[2019-07-17T13:26:03Z] /bin/bash: “buildkite-agent: command not found

Yes! Leaving the quotes off gives me a complaint about the content of the .buildkite/pipeline.yml file, so…that’s progress!!

Thanks for your help!

steps:
   - command: buildkite-agent pipeline upload
    label: “:pipeline:”

That’s so strange, because it should end up as the same thing. But I’m glad it works! :grin:

The other odd bit is that the quotes show up in the web UI around the pipeline icon…as from
label: ":pipeline:"

Oh, it looks like some curly quotes snuck in there. If you replace and with just straight double quotes (") then you should be good.