Pipeline yaml - to call ant targets and check junit results

This is what I’ve got in the yaml at the moment:

steps:
  - apt-get update
  - apt-get -y install ant
  - ant clean test

But it doesn’t seem to want to stick. This shows what we’re calling in jenkins (for comparison).

I should probably state - that I’m using the demo/free docker agent at the moment

Hey @Rafe!

Welcome to the Buildkite Forum :wave: Hope you’re well, thanks for the message!

For each step in a Buildkite pipeline - you’d need to set the command key - and in particular for those 3 commands, you could potentially do something like this:

steps:
  - label: ":ant: Install ant"`
    commands: |
       apt-get update
       apt-get -y install ant
       ant clean test

Note you’ll need to set agent targeting to these steps, otherwise they’ll get targeted to agents on the default queue.

Hope that helps :slight_smile:

Thanks for that - the change does help, however it still isn’t recognising apt-get in the default buildkite agent:

$ trap 'kill -- $$' INT TERM QUIT; apt-get update
apt-get -y install ant
ant clean test
/bin/bash: line 1: apt-get: command not found
🚨 Error: The command exited with status 127
user command error: exit status 127

How do i install Ant (and specific versions of java/etc) in this agent?

Hello again @Rafe!

No worries for before! On that front - has apt been installed on the agent that you are targeting for that specific build? It might be worth running a whoami to verify which user is attempting to run those commands.

Note if this is a Elastic CI Stack instance - the user that is running these commands is the buildkite-agent user.

I’m using the buildkite/agent in the example:

... buildkite/agent                                                                                                 
                                                                                                                                                                                                                                                                             
   _           _ _     _ _    _ _                                _                                                                                                                                                                                                           
  | |         (_) |   | | |  (_) |                              | |                                                                                                                                                                                                          
  | |__  _   _ _| | __| | | ___| |_ ___    __ _  __ _  ___ _ __ | |_                                                                                                                                                                                                         
  | '_ \| | | | | |/ _` | |/ / | __/ _ \  / _` |/ _` |/ _ \ '_ \| __|                                                                                                                                                                                                        
  | |_) | |_| | | | (_| |   <| | ||  __/ | (_| | (_| |  __/ | | | |_                                                                                                                                                                                                         
  |_.__/ \__,_|_|_|\__,_|_|\_\_|\__\___|  \__,_|\__, |\___|_| |_|\__|                                                                                                                                                                                                        
                                                 __/ |                                                                                                                                                                                                                       
 https://buildkite.com/agent                    |___/                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                             
2023-10-24 05:51:26 NOTICE Starting buildkite-agent v3.57.0 with PID: 7                                                                                                                                                                                                      
2023-10-24 05:51:26 NOTICE The agent source code can be found here: https://github.com/buildkite/agent                                                                                                                                                                       
2023-10-24 05:51:26 NOTICE For questions and support, email us at: hello@buildkite.com                                                                                                                                                                                       
2023-10-24 05:51:26 INFO   Configuration loaded path=/buildkite/buildkite-agent.cfg

I’ve made some progress - running the ubuntu image:

docker run -t --name buildkite-agent buildkite/agent:3-ubuntu start --token "SECRET"

now to work out how to publish the results :expressionless:

Fantastic to hear - I had a feeling it was relative to Ubuntu! You might want to run that image with --tags queue=docker (for example) so the specific pipelines you are targeting to run on that Ubuntu container. Buildkite has plugins that manage running jobs inside containers through our Docker/Docker Compose plugins too - which expose all the options as parameters that might help here too :slightly_smiling_face:

I’m assuming you mean publishing Ant based JUnit test results?

That is correct - I want to publish Ant based JUnit results

Trying to get the test results to be accepted by the analytics via the docker agent is proving to be perplexing so far.