# Pipeline yaml - to call ant targets and check junit results

**URL:** <https://forum.buildkite.community/t/pipeline-yaml-to-call-ant-targets-and-check-junit-results/3321>\
**Category:** Pipelines\
**Created:** [October 24, 2023, 6:23am UTC](https://forum.buildkite.community/t/pipeline-yaml-to-call-ant-targets-and-check-junit-results/3321 "2023-10-24T06:23:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafe](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Rafe](https://forum.buildkite.community/u/Rafe)\
**Post date:** [October 24, 2023, 6:23am UTC](https://forum.buildkite.community/t/pipeline-yaml-to-call-ant-targets-and-check-junit-results/3321/1 "2023-10-24T06:23:53Z")

</div>

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

```auto
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).

 ![image](https://us1.discourse-cdn.com/flex016/uploads/buildkite1/original/2X/6/6795bdf008e5a392a92588f66b9940d45ca4f5a8.jpeg)

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

---

<div class="post-metadata">

**Author:** ![james.s](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/james.s/32/1305_2.png) [@james.s](https://forum.buildkite.community/u/james.s)\
**Post date:** [October 24, 2023, 6:47am UTC](https://forum.buildkite.community/t/pipeline-yaml-to-call-ant-targets-and-check-junit-results/3321/2 "2023-10-24T06:47:20Z")

</div>

Hey @Rafe!

Welcome to the Buildkite Forum 👋 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:

```auto
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](https://buildkite.com/docs/agent/v3/queues#targeting-a-queue) to these steps, otherwise they’ll get targeted to agents on the `default` queue.

Hope that helps 🙂

---

<div class="post-metadata">

**Author:** ![Rafe](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Rafe](https://forum.buildkite.community/u/Rafe)\
**Post date:** [October 25, 2023, 3:19am UTC](https://forum.buildkite.community/t/pipeline-yaml-to-call-ant-targets-and-check-junit-results/3321/3 "2023-10-25T03:19:44Z")

</div>

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

```auto
$ 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?

---

<div class="post-metadata">

**Author:** ![james.s](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/james.s/32/1305_2.png) [@james.s](https://forum.buildkite.community/u/james.s)\
**Post date:** [October 25, 2023, 3:46am UTC](https://forum.buildkite.community/t/pipeline-yaml-to-call-ant-targets-and-check-junit-results/3321/4 "2023-10-25T03:46:12Z")

</div>

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](https://buildkite.com/docs/agent/v3/elastic-ci-aws#before-you-start-whats-on-each-machine).

---

<div class="post-metadata">

**Author:** ![Rafe](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Rafe](https://forum.buildkite.community/u/Rafe)\
**Post date:** [October 25, 2023, 4:10am UTC](https://forum.buildkite.community/t/pipeline-yaml-to-call-ant-targets-and-check-junit-results/3321/5 "2023-10-25T04:10:36Z")

</div>

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

```auto
... 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

```

---

<div class="post-metadata">

**Author:** ![Rafe](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Rafe](https://forum.buildkite.community/u/Rafe)\
**Post date:** [October 25, 2023, 4:45am UTC](https://forum.buildkite.community/t/pipeline-yaml-to-call-ant-targets-and-check-junit-results/3321/6 "2023-10-25T04:45:50Z")

</div>

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 😑

---

<div class="post-metadata">

**Author:** ![james.s](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/james.s/32/1305_2.png) [@james.s](https://forum.buildkite.community/u/james.s)\
**Post date:** [October 25, 2023, 5:03am UTC](https://forum.buildkite.community/t/pipeline-yaml-to-call-ant-targets-and-check-junit-results/3321/7 "2023-10-25T05:03:18Z")

</div>

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](https://github.com/buildkite-plugins/docker-buildkite-plugin)/[Docker Compose](https://github.com/buildkite-plugins/docker-compose-buildkite-plugin) plugins too - which expose all the options as parameters that might help here too 🙂

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

---

<div class="post-metadata">

**Author:** ![Rafe](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Rafe](https://forum.buildkite.community/u/Rafe)\
**Post date:** [October 25, 2023, 5:09am UTC](https://forum.buildkite.community/t/pipeline-yaml-to-call-ant-targets-and-check-junit-results/3321/8 "2023-10-25T05:09:20Z")

</div>

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.
