ConcourseCI on ARM64
From the website:
Concourse is an open-source continuous thing-doer.
Built on the simple mechanics of resources, tasks, and jobs, Concourse presents a general approach to automation that makes it great for CI/CD.
ConcourseCI is a light-weight continuous integration/deployment server. It is written in Golang and is maintained by a team at Pivotal/VMWare.
There are many CI/CD solutions out there but not all of them support ARM64 CPU architecture. And CouncourseCI is one of them! The latest version at the moment provides only AMD64 binaries for Linux, MacOS and Windows. There is an open issue since July 2017. But there is an epic on their roadmap so hopefully there will be an official ARM64 release soon!
In the meantime there are two solutions provided by the community:
- https://github.com/cirocosta/concourse-arm — This project produces native executables. I was able to build it but then it failed at runtime and I wasn’t able to use it.
- https://github.com/neumayer/concourse-arm-worker — This project builds an ARM64 Docker image that one can run on an ARM64 machine or on x86_64 machine with the help of QEMU/binfmt. While building it I faced few minor issues which were quickly addressed by Robert Neumayer! Thank you, Robert!
To build the Docker image you just need to execute build.sh on an ARM64 machine. The full log output of this script could be found here.
Before starting the ARM64 worker node you need to start a web node. The web node is responsible to receive the clients’ commands and to execute them on the most appropriate worker node. In addition it provides a web UI where you can manage and visualize the deployed pipelines.
- Download Concourse CI for your platform
# add Concourse bin folder to $PATH (Fish shell)
$ set -x PATH $CONCOURSE_FOLDER/bin $PATH
2. Create RSA keys which are used for authentication between the nodes as explained at “Generating Keys” page:
$ concourse generate-key -t rsa -f ./keys/session_signing_key
$ concourse generate-key -t ssh -f ./keys/tsa_host_key
$ concourse generate-key -t ssh -f ./keys/worker_key
$ cp keys/worker_key.pub keys/authorized_worker_keys
3. The web node needs a PostgresDB database to store its data. An easy way to start them both is to use Docker Compose as explained at the Quick Start page:
$ wget https://concourse-ci.org/docker-compose.yml
4. Edit docker-compose.yml to add some extra environment variables:
5. Start the web node:
$ docker-compose up
6. Check the logs for errors and open http://localhost:8080 to see the UI
7. Go to the ARM64 machine and start the worker node. You will need the worker private key and the TSA host public key that we created earlier. I’ve put them in /home/ubuntu/devel/concourse-work-dir/keys folder.
8. Once the worker is started you will see a log entry in the web node logs similar to this one:
{"timestamp":"2021-01-20T09:25:20.847820026Z","level":"info","source":"tsa","message":"tsa.connection.channel.command.register.done","data":{"command":"forward-worker","remote":"192.168.0.232:40650","session":"46.4.1.2","worker-address":"127.0.0.1:32805","worker-platform":"linux","worker-tags":""}}
9. Use fly (the Concourse command line client) to run commands:
$ fly -t tutorial login -c http://web-node:8080 -u user -p password$ fly -t tutorial workers -d
name containers platform tags team state version age garden address baggageclaim url active tasks resource types
arm64-worker 0 linux none none running 2.2 1m29s 127.0.0.1:32805 http://127.0.0.1:36665 0 registry-image
10. Create a simple task.
Note: the snippets below are slightly modified versions taken from https://concoursetutorial.com!
and execute it :
$ fly -t tutorial execute -c concourse-task-hello-world.yml
executing build 51 at http://127.0.0.1:8080/builds/51
initializing
selected worker: arm64-worker
running echo hello world
hello world
succeeded
11. If you need to use the ARM64 worker node only for specific tasks then you can tag it with CONCOURSE_TAG=arm64 environment variable (see the worker start script above). Then you can use resourse.tags and step.tags to specify which resources and steps should be executed on the ARM64 worker node.
Here is a simple pipeline that executes a task only on worker nodes tagged with arm64:
To run it you need to execute several commands. Here is a Bash script:
$ bash concourse-execute-pipeline.sh
Concourse API target tutorial
Tutorial basic-pipeline
~/git/concourse-tutorial/tutorials/basic/basic-pipeline ~
jobs:
job job-hello-world has been added:
+ name: job-hello-world
+ plan:
+ - config:
+ image_resource:
+ source:
+ repository: arm64v8/busybox
+ tag: latest
+ type: registry-image
+ platform: linux
+ run:
+ args:
+ - hello pipeline
+ path: echo
+ tags:
+ - aarch64
+ task: hello-world
+ public: true
pipeline created!
you can view your pipeline here: http://127.0.0.1:8080/teams/main/pipelines/tutorial-pipelinethe pipeline is currently paused. to unpause, either:
- run the unpause-pipeline command:
fly -t tutorial unpause-pipeline -p tutorial-pipeline
- click play next to the pipeline in the web ui
unpaused 'tutorial-pipeline'
started tutorial-pipeline/job-hello-world #1initializing
selected worker: arm64-worker
running echo hello pipeline
hello pipeline
succeeded
Few days ago I didn’t have any experience with Concourse CI and it took me a while to understand its concepts. I also had to ask few questions at their discussions forum but with the help of Taylor Silva everything went well at the end! Thank you, Taylor!