Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 22.04 Docker Image #1966

Merged
merged 6 commits into from
Feb 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ steps:
- "alpine-k8s"
- "ubuntu-18.04"
- "ubuntu-20.04"
- "ubuntu-22.04"
- "sidecar"

- group: ":docker: Docker Image Tests"
Expand All @@ -173,6 +174,7 @@ steps:
- alpine-k8s
- ubuntu-18.04
- ubuntu-20.04
- ubuntu-22.04
- sidecar

- name: ":docker: {{matrix.variant}} arm64 image test"
Expand All @@ -189,6 +191,7 @@ steps:
- alpine-k8s
- ubuntu-18.04
- ubuntu-20.04
- ubuntu-22.04
- sidecar

- name: ":debian: Debian package build"
Expand Down
11 changes: 9 additions & 2 deletions .buildkite/steps/build-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -Eeufo pipefail

## This script can be run locally like this:
##
## .buildkite/steps/build-docker-image.sh (alpine|alpine-k8s|ubuntu-18.04|ubuntu-20.04|sidecar) (image tag) (codename) (version)
## .buildkite/steps/build-docker-image.sh (alpine|alpine-k8s|ubuntu-18.04|ubuntu-20.04|ubuntu-22.04|sidecar) (image tag) (codename) (version)
## e.g: .buildkite/steps/build-docker-image.sh alpine buildkiteci/agent:lox-manual-build stable 3.1.1
##
## You can then publish that image with
Expand All @@ -21,7 +21,7 @@ codename="${3:-}"
version="${4:-}"
push="${PUSH_IMAGE:-true}"

if [[ ! "$variant" =~ ^(alpine|alpine-k8s|ubuntu-18\.04|ubuntu-20\.04|sidecar)$ ]] ; then
if [[ ! "$variant" =~ ^(alpine|alpine-k8s|ubuntu-18\.04|ubuntu-20\.04|ubuntu-22\.04|sidecar)$ ]] ; then
echo "Unknown docker variant $variant"
exit 1
fi
Expand Down Expand Up @@ -60,6 +60,13 @@ builder_name=$(docker buildx create --use)
# shellcheck disable=SC2064 # we want the current $builder_name to be trapped, not the runtime one
trap "docker buildx rm $builder_name || true" EXIT

# Needed for buildking multiarch
# See https://github.com/docker/buildx/issues/314
QEMU_VERSION=6.2.0
echo "--- Installing QEMU $QEMU_VERSION"
docker run --privileged --userns=host --rm "tonistiigi/binfmt:qemu-v$QEMU_VERSION" --uninstall qemu-*
docker run --privileged --userns=host --rm "tonistiigi/binfmt:qemu-v$QEMU_VERSION" --install all

echo "--- Building :docker: $image_tag"
cp -a packaging/linux/root/usr/share/buildkite-agent/hooks/ "${packaging_dir}/hooks/"
cp pkg/buildkite-agent-linux-{amd64,arm64} "$packaging_dir"
Expand Down
4 changes: 4 additions & 0 deletions .buildkite/steps/extract-agent-version-metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ docker_alpine_image_tag="$registry:alpine-build-${BUILDKITE_BUILD_NUMBER}"
docker_alpine_k8s_image_tag="$registry:alpine-k8s-build-${BUILDKITE_BUILD_NUMBER}"
docker_ubuntu_bionic_image_tag="$registry:ubuntu-18.04-build-${BUILDKITE_BUILD_NUMBER}"
docker_ubuntu_focal_image_tag="$registry:ubuntu-20.04-build-${BUILDKITE_BUILD_NUMBER}"
docker_ubuntu_jammy_image_tag="$registry:ubuntu-22.04-build-${BUILDKITE_BUILD_NUMBER}"

docker_sidecar_image_tag="$registry:sidecar-build-${BUILDKITE_BUILD_NUMBER}"

is_prerelease=0
Expand All @@ -24,6 +26,7 @@ echo "Build version: $build_version"
echo "Docker Alpine Image Tag: $docker_alpine_image_tag"
echo "Docker Ubuntu 18.04 Image Tag: $docker_ubuntu_bionic_image_tag"
echo "Docker Ubuntu 20.04 Image Tag: $docker_ubuntu_focal_image_tag"
echo "Docker Ubuntu 22.04 Image Tag: $docker_ubuntu_jammy_image_tag"
echo "Docker Sidecar Image Tag: $docker_sidecar_image_tag"
echo "Is prerelease? $is_prerelease"

Expand All @@ -34,5 +37,6 @@ buildkite-agent meta-data set "agent-docker-image-alpine" "$docker_alpine_image_
buildkite-agent meta-data set "agent-docker-image-alpine-k8s" "$docker_alpine_k8s_image_tag"
buildkite-agent meta-data set "agent-docker-image-ubuntu-18.04" "$docker_ubuntu_bionic_image_tag"
buildkite-agent meta-data set "agent-docker-image-ubuntu-20.04" "$docker_ubuntu_focal_image_tag"
buildkite-agent meta-data set "agent-docker-image-ubuntu-22.04" "$docker_ubuntu_jammy_image_tag"
buildkite-agent meta-data set "agent-docker-image-sidecar" "$docker_sidecar_image_tag"
buildkite-agent meta-data set "agent-is-prerelease" "$is_prerelease"
4 changes: 2 additions & 2 deletions .buildkite/steps/publish-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ if [[ "$codename" == "stable" ]] ; then
done
release_image "${variant}"

# publish bare 'ubuntu' only from ubuntu-20.04
if [[ "$variant" == "ubuntu-20.04" ]] ; then
# publish bare 'ubuntu' only from ubuntu-22.04
if [[ "$variant" == "ubuntu-22.04" ]] ; then
for tag in $(parse_version "$version") ; do
release_image "${tag}-ubuntu"
done
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/steps/publish-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ aws ssm get-parameter --name /pipelines/agent/DOCKER_HUB_PASSWORD --with-decrypt
version=$(buildkite-agent meta-data get "agent-version")
build=$(buildkite-agent meta-data get "agent-version-build")

for variant in "alpine" "alpine-k8s" "ubuntu-18.04" "ubuntu-20.04" "sidecar" ; do
for variant in "alpine" "alpine-k8s" "ubuntu-18.04" "ubuntu-20.04" "ubuntu-22.04" "sidecar" ; do
echo "--- Getting docker image tag for $variant from build meta data"
source_image=$(buildkite-agent meta-data get "agent-docker-image-$variant")
echo "Docker Image Tag for $variant: $source_image"
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/steps/upload-release-steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ trigger_step() {
'agent-docker-image-alpine-k8s': "${agent_docker_image_alpine_k8s}"
'agent-docker-image-ubuntu-18.04': "${agent_docker_image_ubuntu_bionic}"
'agent-docker-image-ubuntu-20.04': "${agent_docker_image_ubuntu_focal}"
'agent-docker-image-ubuntu-22.04': "${agent_docker_image_ubuntu_jammy}"
agent-docker-image-sidecar: "${agent_docker_image_sidecar}"
agent-is-prerelease: "${agent_is_prerelease}"
env:
Expand Down Expand Up @@ -82,6 +83,7 @@ agent_docker_image_alpine=$(buildkite-agent meta-data get "agent-docker-image-al
agent_docker_image_alpine_k8s=$(buildkite-agent meta-data get "agent-docker-image-alpine-k8s")
agent_docker_image_ubuntu_bionic=$(buildkite-agent meta-data get "agent-docker-image-ubuntu-18.04")
agent_docker_image_ubuntu_focal=$(buildkite-agent meta-data get "agent-docker-image-ubuntu-20.04")
agent_docker_image_ubuntu_jammy=$(buildkite-agent meta-data get "agent-docker-image-ubuntu-22.04")
agent_docker_image_sidecar=$(buildkite-agent meta-data get "agent-docker-image-sidecar")
agent_is_prerelease=$(buildkite-agent meta-data get "agent-is-prerelease")

Expand Down
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ updates:
interval: "monthly"
ignore:
- dependency-name: ubuntu
- package-ecosystem: "docker"
directory: /packaging/docker/ubuntu-22.04
schedule:
interval: "monthly"
ignore:
- dependency-name: ubuntu
- package-ecosystem: "docker"
directory: /.buildkite
schedule:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ For example, agent version 3.30.0 is published as:
- Alpine 3.12
- Ubuntu 18.04 LTS (x86_64), supported to end of life for 18.04
- Ubuntu 20.04 LTS (x86_64), supported to end of life for 20.04
- Ubuntu 22.04 LTS (x86_64), supported to end of life for 22.04

## Starting

Expand Down
58 changes: 58 additions & 0 deletions packaging/docker/ubuntu-22.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# syntax=docker/dockerfile:1.4

FROM ubuntu:22.04

ARG TARGETOS
ARG TARGETARCH

ARG DOCKER_COMPOSE_VERSION=1.27.4

RUN <<BASH
#!/usr/bin/env bash

set -eufo pipefail

export DEBIAN_FRONTEND=noninteractive

apt-get update
apt-get install -y --no-install-recommends \
apt-transport-https \
bash \
ca-certificates \
curl \
git \
gnupg-agent \
jq \
openssh-client \
perl \
python3 \
python3-pip \
rsync \
software-properties-common \
tini

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=$TARGETARCH] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install -y --no-install-recommends docker-ce-cli docker-compose-plugin
rm -rf /var/lib/apt/lists/*

pip3 install docker-compose==$DOCKER_COMPOSE_VERSION

ln -s /usr/bin/tini /usr/sbin/tini

mkdir -p /buildkite/builds /buildkite/hooks /buildkite/plugins
curl -Lfs -o /usr/local/bin/ssh-env-config.sh https://raw.githubusercontent.com/buildkite/docker-ssh-env-config/master/ssh-env-config.sh
chmod +x /usr/local/bin/ssh-env-config.sh
BASH

ENV BUILDKITE_AGENT_CONFIG=/buildkite/buildkite-agent.cfg \
PATH="/usr/local/bin:${PATH}"

COPY ./buildkite-agent.cfg /buildkite/buildkite-agent.cfg
COPY ./buildkite-agent-$TARGETOS-$TARGETARCH /usr/local/bin/buildkite-agent
COPY ./entrypoint.sh /usr/local/bin/buildkite-agent-entrypoint

VOLUME /buildkite
ENTRYPOINT ["buildkite-agent-entrypoint"]
CMD ["start"]
67 changes: 67 additions & 0 deletions packaging/docker/ubuntu-22.04/buildkite-agent.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# The token from your Buildkite "Agents" page
#token="xxx"

# The name of the agent
name="%hostname-%spawn"

# The number of agents to spawn in parallel (default is "1")
# spawn=1

# The priority of the agent (higher priorities are assigned work first)
# priority=1

# Tags for the agent (default is "queue=default")
# tags="key1=val2,key2=val2"

# Include the host's EC2 meta-data as tags (instance-id, instance-type, and ami-id)
# tags-from-ec2=true

# Include the host's EC2 tags as tags
# tags-from-ec2-tags=true

# Include the host's Google Cloud instance meta-data as tags (instance-id, machine-type, preemptible, project-id, region, and zone)
# tags-from-gcp=true

# Include the host's Google Cloud instance labels as tags
# tags-from-gcp-labels=true

# Path to a custom bootstrap command to run. By default this is `buildkite-agent bootstrap`.
# This allows you to override the entire execution of a job. Generally you should use hooks instead!
# See https://buildkite.com/docs/agent/hooks
# bootstrap-script=""

# Path to where the builds will run from
build-path="/buildkite/builds"

# Directory where the hook scripts are found
hooks-path="/buildkite/hooks"

# Directory where plugins will be installed
plugins-path="/buildkite/plugins"

# Flags to pass to the `git clone` command
# git-clone-flags=-v

# Flags to pass to the `git clean` command
# git-clean-flags=-ffxdq

# Do not run jobs within a pseudo terminal
# no-pty=true

# Don't automatically verify SSH fingerprints
# no-automatic-ssh-fingerprint-verification=true

# Don't allow this agent to run arbitrary console commands
# no-command-eval=true

# Don't allow this agent to run plugins
# no-plugins=true

# Enable debug mode
# debug=true

# Don't show colors in logging
# no-color=true

# If set and valid, the given tracing backend will be enabled. Eg: datadog
# tracing-backend=""
11 changes: 11 additions & 0 deletions packaging/docker/ubuntu-22.04/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail

DIR=/docker-entrypoint.d

if [[ -d "$DIR" ]] ; then
echo "Executing scripts in $DIR"
/bin/run-parts --exit-on-error "$DIR"
fi

exec /usr/bin/tini -- ssh-env-config.sh /usr/local/bin/buildkite-agent "$@"