How do I set up a Rust build runner on Ubuntu?

Deleted user August 18, 2022

I have a CI server in an AWS cloud which hosts our BitBucket.

The runners are on a separate EC2 instance.

The code we are using is Rust.

I installed the runners on a windows EC2 and everything is fine.

I follow the instructions to install the runners on a Linux machine (Ubuntu) and the runners cannot find Cargo.  

When I connect to the machine I can run it manually from any directory so it should be viewable by the build runner.

Is this because the docker image cannot see outside of the docker container so I need to add lines to the docker image to install Rust?  If so, how do I do that?

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2022

Hi Steven,

Linux runners cannot access files and programs from the host system.

With Linux runners, you have the Docker container of the runner running on your system.
Every time a build is triggered for that runner, a separate Docker container starts (the build container) where the build runs, and then it gets destroyed when the build finishes.

The build container uses the Docker image you have defined in bitbucket-pipelines.yml. If you don't specify a Docker image to use as your build environment in bitbucket-pipelines.yml, then the default one is used.

If you need tools that are not available in the default image, then

  • you can install them during the build by adding the necessary commands in the bitbucket-pipelines.yml file
  • alternatively, you can create a custom Docker image where you install these tools, and then use this image as a build container by specifying it in the bitbucket-pipelines.yml file.
    We support public and private Docker images including those hosted on Docker Hub, AWS, GCP, Azure, and self-hosted registries accessible on the internet.

You can check below the resources we have about creating a custom Docker image:

Kind regards,
Theodora

Deleted user August 22, 2022

Ah, this helps a lot, thanks.

If I add these steps to the yml file will they get run every time a build happens or can I configure it so it would only happen the first time a runner is run? 

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2022

Hi Steven,

You are very welcome, I'm glad to have helped!

Any commands you have in the script of a step in bitbucket-pipelines.yml will run every time a build runs.

It is not possible to configure any build details when starting the runner.

The other solution is to create a custom Docker image and specify that image in bitbucket-pipelines.yml.

You can place any commands that install tools in the Dockerfile of your custom Docker image, then build the image and push it to Docker Hub, AWS, GCP, Azure, or a self-hosted registry accessible on the internet, so you can use it in bitbucket-pipelines.yml.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events