diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 42ce4a7..1e01d0c 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -18,7 +18,7 @@ '/Earthfile/', ], matchStrings: [ - '\\s*#\\s*renovate:\\s*datasource=(?.*?)\\s+depName=(?.*?)[\\s\\n]+(versioning=(?.*?)\\s+)?(ARG|LET)\\s+.*?(_VERSION|_VER|version)=(?.*?)($|\\s|\\n)', + '\\s*#\\s*renovate:\\s*datasource=(?\\S+)\\s+depName=(?\\S+)(?:\\s+packageName=(?\\S+))?[\\s\\n]+(versioning=(?\\S+)\\s+)?(ARG|LET)\\s+.*?(_VERSION|_VER|version)=(?.*?)($|\\s|\\n)', ], }, { @@ -40,44 +40,49 @@ '/^README.md$/', ], matchStrings: [ - '\\*\\s+\\`(?.+?)\\`\\n', + '\\*\\s+\\`alpine-3\\.22-docker-(?.*?)\\`\\n', ], - depNameTemplate: 'earthbuild/dind', - datasourceTemplate: 'docker', + depNameTemplate: 'alpine_3_22/docker', + datasourceTemplate: 'repology', + versioningTemplate: 'loose', }, - ], - labels: [ - 'renovate', - ], - packageRules: [ { - groupName: "{{{ replace 'os\\/(.*?)$' '$1' packageFileDir}}}-dind-image", - matchManagers: [ - 'custom.regex', + customType: 'regex', + managerFilePatterns: [ + '/^README.md$/', ], - matchDatasources: [ - 'docker', - 'repology', - 'github-releases', + matchStrings: [ + '\\*\\s+\\`alpine-3\\.23-docker-(?.*?)\\`\\n', ], - matchFileNames: [ - 'os/**/Earthfile', + depNameTemplate: 'alpine_3_23/docker', + datasourceTemplate: 'repology', + versioningTemplate: 'loose', + }, + { + customType: 'regex', + managerFilePatterns: [ + '/^README.md$/', ], - matchPackageNames: [ - '/alpine/', - '/alpine.*?/docker/', - 'moby/moby', + matchStrings: [ + '\\*\\s+\\`ubuntu-(?\\d+\\.\\d+)-docker-(?.*?)-\\d+\\`\\n', ], + depNameTemplate: 'moby/moby-{{{osVersion}}}', + packageNameTemplate: 'moby/moby', + datasourceTemplate: 'github-releases', + versioningTemplate: 'semver-coerced', }, + ], + labels: [ + 'renovate', + ], + packageRules: [ { - // Lock docker to v28.1.1 for Ubuntu 20.04. - matchFileNames: [ - 'os/ubuntu-20.04/Earthfile', - ], - matchPackageNames: [ - 'moby/moby', + // Lock docker to v28.1.1 for Ubuntu 20.04 and disable updates. + matchDepNames: [ + 'moby/moby-20.04', ], allowedVersions: '28.1.1', + enabled: false, }, { automerge: true, @@ -85,54 +90,9 @@ '*', ], }, - { - groupName: 'docs-dind-images', - matchPackageNames: [ - 'earthbuild/dind', - ], - matchCurrentVersion: '/^alpine-3\\.22-.*/', - allowedVersions: '/^alpine-3\\.22-.*/', - versioning: 'regex:^(?.*)-(?\\d+\\.\\d+)-docker-(?\\d+)\\.(?\\d+)\\.(?\\d+)-r(?\\d+)$', - }, - { - groupName: 'docs-dind-images', - matchPackageNames: [ - 'earthbuild/dind', - ], - matchCurrentVersion: '/^alpine-3\\.23-.*/', - allowedVersions: '/^alpine-3\\.23-.*/', - versioning: 'regex:^(?.*)-(?\\d+\\.\\d+)-docker-(?\\d+)\\.(?\\d+)\\.(?\\d+)-r(?\\d+)$', - }, - { - groupName: 'docs-dind-images', - matchPackageNames: [ - 'earthbuild/dind', - ], - matchCurrentVersion: '/^ubuntu-20\\.04-.*/', - allowedVersions: '/^ubuntu-20\\.04-.*/', - versioning: 'regex:^(?.*)-(?\\d+\\.\\d+)-docker-(?\\d+)\\.(?\\d+)\\.(?\\d+)-(?\\d+)$', - }, - { - groupName: 'docs-dind-images', - matchPackageNames: [ - 'earthbuild/dind', - ], - matchCurrentVersion: '/^ubuntu-24\\.04-.*/', - allowedVersions: '/^ubuntu-24\\.04-.*/', - versioning: 'regex:^(?.*)-(?\\d+\\.\\d+)-docker-(?\\d+)\\.(?\\d+)\\.(?\\d+)-(?\\d+)$', - }, - { - groupName: 'docs-dind-images', - matchPackageNames: [ - 'earthbuild/dind', - ], - matchCurrentVersion: '/^ubuntu-26\\.04-.*/', - allowedVersions: '/^ubuntu-26\\.04-.*/', - versioning: 'regex:^(?.*)-(?\\d+\\.\\d+)-docker-(?\\d+)\\.(?\\d+)\\.(?\\d+)-(?\\d+)$', - }, { matchPackageNames: [ - 'moby/moby', + '/^moby\\/moby/', ], matchDatasources: [ 'github-releases', diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 232131b..535dd4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,6 @@ jobs: test: name: test (${{ matrix.os }}) strategy: - matrix: os: - alpine-3.22 @@ -32,9 +31,7 @@ jobs: contents: read packages: write env: - FORCE_COLOR: 1 EARTHLY_CONVERSION_PARALLELISM: "5" - EARTHLY_INSTALL_ID: "earthbuild-dind-githubactions" steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # The dind (common+alpine-kind-test and common+ubuntu-kind-test) detects diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 746d863..4d1b623 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,23 +1,26 @@ name: Release on: - pull_request_target: - types: [ closed ] + push: + branches: + - main + paths: + - 'os/**/Earthfile' + - 'README.md' jobs: release: - name: release after merging ${{ github.head_ref }} - if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'renovate/') && endsWith(github.head_ref, '-dind-image') + name: release after merge runs-on: ubuntu-latest permissions: contents: read packages: write env: - FORCE_COLOR: 1 EARTHLY_CONVERSION_PARALLELISM: "5" - EARTHLY_INSTALL_ID: "earthbuild-dind-githubactions" steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + fetch-depth: 0 # The dind (common+alpine-kind-test and common+ubuntu-kind-test) detects # the host's IPv6 capability and then requires IPv6 NAT to create networks # for kind. So we load it here. @@ -40,10 +43,23 @@ jobs: run: |- docker login --username "${{ vars.DOCKERHUB_USERNAME }}" --password "${{ secrets.DOCKERHUB_TOKEN }}" docker login ghcr.io --username ${{ github.actor }} --password "${{ secrets.GITHUB_TOKEN }}" - if: github.event.pull_request.head.repo.full_name == github.repository + if: github.repository == 'earthbuild/dind' - name: Build & Push image - env: - RENOVATE_BRANCH: ${{ github.head_ref }} run: | - earth --ci -P --push +release --RENOVATE_BRANCH="$RENOVATE_BRANCH" # default:ghcr.io - earth --ci -P --push +release --RENOVATE_BRANCH="$RENOVATE_BRANCH" --CR_HOST=docker.io + # Detect changed Earthfiles + CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} || git diff --name-only HEAD^ HEAD || true) + echo "Changed files: $CHANGED_FILES" + + # Extract unique OS names + OS_LIST=$(echo "$CHANGED_FILES" | grep '^os/.*/Earthfile$' | awk -F'/' '{print $2}' | sort -u || true) + + if [ -z "$OS_LIST" ]; then + echo "No OS Earthfiles changed. Skipping build." + exit 0 + fi + + for OS in $OS_LIST; do + echo "Releasing OS: $OS" + earth --ci -P --push +release --OS="$OS" # default:ghcr.io + earth --ci -P --push +release --OS="$OS" --CR_HOST=docker.io + done diff --git a/Earthfile b/Earthfile index b17b43b..48ec8b9 100644 --- a/Earthfile +++ b/Earthfile @@ -5,16 +5,9 @@ test: ARG --required OS BUILD --pass-args ./os/$OS+test-build -# release expects to get a renovate branch in the form of renovate/-dind-image, extracts the os and then kicks off its +release target +# release builds and pushes the image for a specific OS # this is meant to be run by a github workflow release: FROM alpine:3.23.4@sha256:5b10f432ef3da1b8d4c7eb6c487f2f5a8f096bc91145e68878dd4a5019afde11 - # RENOVATE_BRANCH is the renovate branch that is expected to get merged and trigger this target - ARG --required RENOVATE_BRANCH - LET os=${RENOVATE_BRANCH#renovate/} - # remove major-XX- or major- - SET os=$(echo ${os#major-[[:digit:]]?-}) - SET os=${os#major-} - # using a LET/SET in the target path does not work, use an ARG instead until it's fixed - ARG OS=${os%-dind-image} + ARG --required OS BUILD --pass-args ./os/$OS+release diff --git a/README.md b/README.md index a6e2e10..086aa9e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ For which the current latest tags (respectively) are: * `alpine-3.23-docker-29.1.2-r1` * `ubuntu-20.04-docker-28.1.1-1` * `ubuntu-24.04-docker-28.5.1-1` -* `ubuntu-26.04-docker-29.4.1-1` +* `ubuntu-26.04-docker-29.4.0-1` For other available tags, please check out [ghcr.io/earthbuild/dind](https://github.com/earthbuild/dind/pkgs/container/dind/versions?filters%5Bversion_type%5D=tagged) or [earthbuild/dind](https://hub.docker.com/r/earthbuild/dind/tags). diff --git a/os/ubuntu-20.04/Earthfile b/os/ubuntu-20.04/Earthfile index ca736d0..949de33 100644 --- a/os/ubuntu-20.04/Earthfile +++ b/os/ubuntu-20.04/Earthfile @@ -7,7 +7,7 @@ IMPORT ../../common AS common ARG --global OS_IMAGE=ubuntu ARG --global OS_VERSION=20.04 -# renovate: datasource=github-releases depName=moby/moby +# renovate: datasource=github-releases depName=moby/moby-20.04 packageName=moby/moby LET docker_package_version=28.1.1 ARG --global DOCKER_VERSION=5:$docker_package_version-1~ubuntu.$OS_VERSION~focal diff --git a/os/ubuntu-24.04/Earthfile b/os/ubuntu-24.04/Earthfile index f576ad8..5602fbf 100644 --- a/os/ubuntu-24.04/Earthfile +++ b/os/ubuntu-24.04/Earthfile @@ -7,7 +7,7 @@ IMPORT ../../common AS common ARG --global OS_IMAGE=ubuntu ARG --global OS_VERSION=24.04 -# renovate: datasource=github-releases depName=moby/moby +# renovate: datasource=github-releases depName=moby/moby-24.04 packageName=moby/moby LET docker_package_version=28.5.2 ARG --global DOCKER_VERSION=5:$docker_package_version-1~ubuntu.$OS_VERSION~noble diff --git a/os/ubuntu-26.04/Earthfile b/os/ubuntu-26.04/Earthfile index 8b20b28..2aff590 100644 --- a/os/ubuntu-26.04/Earthfile +++ b/os/ubuntu-26.04/Earthfile @@ -7,8 +7,8 @@ IMPORT ../../common AS common ARG --global OS_IMAGE=ubuntu ARG --global OS_VERSION=26.04 -# renovate: datasource=github-releases depName=moby/moby -LET docker_package_version=29.4.1 +# renovate: datasource=github-releases depName=moby/moby-26.04 packageName=moby/moby +LET docker_package_version=29.4.0 ARG --global DOCKER_VERSION=5:$docker_package_version-1~ubuntu.$OS_VERSION~resolute # DIR_PATH is set to that common targets can call os specific targets. It should match the directory name this Earthfile is located in