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

[WIP] gha: Nightly packages #1061

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
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
111 changes: 111 additions & 0 deletions .github/workflows/.nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# reusable workflow
name: .build

# TODO: hide reusable workflow from the UI. Tracked in https://github.com/community/community/discussions/12025

# Default to 'contents: read', which grants actions to read commits.
#
# If any permission is set, any permission not included in the list is
# implicitly set to "none".
#
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read

on:
workflow_call:
inputs:
arch:
required: true
type: string
default: "amd64"
target:
required: true
type: string
image:
required: true
type: string

jobs:
# Transform the arch into a specific worker
# amd64 -> ubuntu-22.04
# arm64 -> ubuntu22_arm64
prepare:
runs-on: ubuntu-22.04
outputs:
worker: ${{ steps.set.outputs.worker }}
version: ${{ steps.set.outputs.version }}
steps:
-
name: Set worker
id: set
run: |
echo "version=$(date +%Y%m%d)" >> $GITHUB_OUTPUT
case ${{ inputs.arch }} in
amd64|static*|cross*)
echo "worker=ubuntu-20.04" >> $GITHUB_OUTPUT
;;
arm64|armhf)
echo "worker=ubuntu22_arm64" >> $GITHUB_OUTPUT
;;
*)
echo "::error::Unsupported arch: ${{ inputs.arch }}"
exit 1
;;
esac

build:
needs: prepare
runs-on: ${{ needs.prepare.outputs.worker }}
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

-
name: Checkout
uses: actions/checkout@v4

-
name: Build
run: |
export VERSION=${{ needs.prepare.outputs.version }}
export REF=master

export DOCKER_BUILDX_REF=master
export DOCKER_BUILDX_VERSION=$VERSION

export DOCKER_COMPOSE_REF=main
export DOCKER_COMPOSE_VERSION=$VERSION

if [ "${{ inputs.target }}" == static ]; then
export DOCKER_BUILD_PKGS="${{ inputs.arch }}"
else
export ARCH=${{ inputs.arch }}
fi

make ${{ inputs.target }}

-
name: Verify
if: ${{ inputs.image != '' }}
run: |
export IMAGE=${{ inputs.image }}
export ARCH=${{ inputs.arch }}

if [ "$ARCH" == "armhf" ]; then
export VERIFY_PLATFORM="--platform linux/arm/v7"
fi

make verify

-
name: Artifact deb
uses: actions/upload-artifact@v4
with:
name: nightly-${{ inputs.target }}-${{ inputs.arch }}
path: |
deb/debbuild/${{ inputs.target }}
rpm/rpmbuild/${{ inputs.target }}
static/build
retention-days: 1
35 changes: 0 additions & 35 deletions .github/workflows/ci.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: nightly

on:
workflow_dispatch:
pull_request:

jobs:
packages:
strategy:
fail-fast: false
matrix:
arch:
- amd64
- arm64
dist:
#- {target: "debian-bullseye", image: "debian:bullseye"}
- {target: "debian-bookworm", image: "debian:bookworm"}
#- {target: "ubuntu-focal", image: "ubuntu:focal"}
#- {target: "ubuntu-jammy", image: "ubuntu:jammy"}
#- {target: "ubuntu-noble", image: "ubuntu:noble"}

#- {target: "centos-9", image: "quay.io/centos/centos:stream9"}
#- {target: "fedora-39", image: "fedora:39"}
#- {target: "fedora-40", image: "fedora:40"}
#- {target: "rhel-8", image: "registry.access.redhat.com/ubi8/ubi"}
#- {target: "rhel-9", image: "registry.access.redhat.com/ubi9/ubi"}
include:
- arch: static-linux
dist: {target: "static", image: ""}
- arch: cross-mac
dist: {target: "static", image: ""}
- arch: cross-win
dist: {target: "static", image: ""}
- arch: armhf
dist: {target: "debian-bookworm", image: "debian:bookworm"}
#- arch: armhf
# dist: {target: "debian-bullseye", image: "debian:bullseye"}
#- arch: armhf
# dist: {target: "ubuntu-focal", image: "ubuntu:focal"}
#- arch: armhf
# dist: {target: "ubuntu-jammy", image: "ubuntu:jammy"}
#- arch: armhf
# dist: {target: "ubuntu-noble", image: "ubuntu:noble"}
# TODO
# - arch: armhf
# dist: {target: "raspbian-bullseye", image: "balenalib/rpi-raspbian:bullseye"}
# - arch: armhf
# dist: {target: "raspbian-bookworm", image: "balenalib/rpi-raspbian:bookworm"}
uses: ./.github/workflows/.nightly.yml
with:
arch: ${{ matrix.arch }}
target: ${{ matrix.dist.target }}
image: ${{ matrix.dist.image }}

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ debian-% raspbian-% ubuntu-%: checkout ## build deb packages for the specified d
$(MAKE) -C deb VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) $@

.PHONY: static
static: DOCKER_BUILD_PKGS:=static-linux cross-mac cross-win cross-arm
static: DOCKER_BUILD_PKGS:=static-linux cross-mac cross-win
static: checkout ## build static-compiled packages
for p in $(DOCKER_BUILD_PKGS); do \
$(MAKE) -C $@ VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) TARGETPLATFORM=$(TARGETPLATFORM) CONTAINERD_VERSION=$(CONTAINERD_VERSION) RUNC_VERSION=$(RUNC_VERSION) $${p}; \
Expand Down
5 changes: 4 additions & 1 deletion common.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARCH=$(shell uname -m)
ARCH?=$(shell uname -m)

# These are the architecture formats as used in release-packaging Jenkinsfile
# This is an ugly chimera, nobody uses this combination of dpkg and uname formats
Expand Down Expand Up @@ -45,6 +45,9 @@ DOCKER_COMPOSE_REF ?= v2.29.2
# but can be a valid git reference in DOCKER_BUILDX_REPO.
DOCKER_BUILDX_REF ?= v0.16.2

DOCKER_BUILDX_VERSION ?= $(DOCKER_BUILDX_REF)
DOCKER_COMPOSE_VERSION ?= $(DOCKER_COMPOSE_REF)

# Use "stage" to install dependencies from download-stage.docker.com during the
# verify step. Leave empty or use any other value to install from download.docker.com
VERIFY_PACKAGE_REPO ?= prod
Expand Down
4 changes: 2 additions & 2 deletions deb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ GO_BASE_IMAGE=golang
GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-bookworm
EPOCH?=5
GEN_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/cli) "$(VERSION)")
GEN_BUILDX_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/buildx) "$(DOCKER_BUILDX_REF)")
GEN_COMPOSE_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/compose) "$(DOCKER_COMPOSE_REF)")
GEN_BUILDX_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/buildx) "$(DOCKER_BUILDX_VERSION)")
GEN_COMPOSE_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/compose) "$(DOCKER_COMPOSE_VERSION)")
CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD)
ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD)
BUILDX_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/buildx) && git rev-parse --short HEAD)
Expand Down
4 changes: 2 additions & 2 deletions rpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ PLUGINS_DIR=$(realpath $(CURDIR)/../plugins)
GO_BASE_IMAGE=golang
GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-bookworm
GEN_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/cli) "$(VERSION)")
GEN_BUILDX_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/buildx) "$(DOCKER_BUILDX_REF)")
GEN_COMPOSE_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/compose) "$(DOCKER_COMPOSE_REF)")
GEN_BUILDX_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/buildx) "$(DOCKER_BUILDX_VERSION)")
GEN_COMPOSE_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/compose) "$(DOCKER_COMPOSE_VERSION)")
CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD)
ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD)
BUILDX_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/buildx) && git rev-parse --short HEAD)
Expand Down