Skip to content

Feature: exclude architectures #240

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

Merged
merged 9 commits into from
Apr 28, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Install babashka
uses: DeLaGuardo/[email protected]
with:
bb: 1.3.190
bb: 1.12.199
- uses: actions/checkout@v4
- name: Check for stale Dockerfiles
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/official-images-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Install babashka
uses: DeLaGuardo/setup-clojure@12.5
uses: DeLaGuardo/setup-clojure@13.2
with:
bb: 1.3.190
bb: 1.12.199
- name: Checkout code
uses: actions/checkout@v4
- name: Generate manifest
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
github-username: ${{ github.actor }}
token: ${{ secrets.API_TOKEN_GITHUB }}
- name: Open official-images pull request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.API_TOKEN_GITHUB }}
path: official-images
Expand Down
10 changes: 4 additions & 6 deletions bb.edn
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{:paths ["src"]
:deps {local/deps {:local/root "."}
org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
:git/sha "951b49b8c173244e66443b8188e3ff928a0a71e7"}}
:git/sha "b6eb0f2208ab036c0a5d0e7235cb0b09d2feabb7"}}
:tasks
{:requires ([docker-clojure.core :as dc])
{:requires ([babashka.deps :as deps]
[docker-clojure.core :as dc])
clean (dc/-main "clean")
dockerfiles {:depends [clean]
:task (apply dc/-main "dockerfiles" *command-line-args*)}
manifest (apply dc/-main "manifest" *command-line-args*)
build-images {:task (apply dc/-main "build-images" *command-line-args*)}
test {:extra-paths ["test"]
:requires ([docker-clojure.test-runner :as tr])
:task (tr/-main 'docker-clojure.core-test 'docker-clojure.dockerfile-test
'docker-clojure.manifest-test)}}}
test (deref (deps/clojure '-X:test))}}
13 changes: 8 additions & 5 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{:deps
{org.clojure/clojure {:mvn/version "1.12.0"}
org.clojure/math.combinatorics {:mvn/version "0.3.0"}
org.clojure/core.async {:mvn/version "1.6.681"}}
org.clojure/core.async {:mvn/version "1.8.741"}
com.gfredericks/test.chuck {:git/url "https://github.com/gfredericks/test.chuck"
:git/sha "3e129a11ce9cc1a57584fa022b9b05ab7546a609"}}

:paths ["src" "resources"]

Expand All @@ -11,7 +13,8 @@
:parallelization 2}}

:test {:extra-paths ["test"]
:extra-deps {com.cognitect/test-runner
{:git/url "https://github.com/cognitect-labs/test-runner.git"
:sha "9d36f36ff541dac680a05010e4348c744333f191"}}
:main-opts ["-m" "cognitect.test-runner"]}}}
:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}
orchestra/orchestra {:mvn/version "2021.01.01-1"}
org.clojure/test.check {:mvn/version "1.1.1"}}
:exec-fn docker-clojure.fix-kaocha/run-tests
:exec-args {}}}}
73 changes: 53 additions & 20 deletions src/docker_clojure/config.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
(ns docker-clojure.config
(:require [clojure.spec.alpha :as s]
[clojure.spec.gen.alpha :as gen]
[clojure.string :as str]
[com.gfredericks.test.chuck.generators :as gen']
[docker-clojure.core :as-alias core]))

(s/def ::non-blank-string
Expand All @@ -13,25 +15,60 @@
(s/def ::base-image ::non-blank-string)
(s/def ::base-images (s/coll-of ::base-image :distinct true :into #{}))

(s/def ::docker-image-name (s/and ::non-blank-string
#(re-matches #"[-\w]+(?::[-\w.]+)?" %)))
(s/def ::docker-tag (s/and ::non-blank-string
#(re-matches #"[-\w.]+" %)))
(def docker-image-name-re (re-pattern "[-\\w]+(?::[-\\w.]+)?"))

(s/def ::docker-image-name
(s/with-gen
(s/and ::non-blank-string
#(re-matches docker-image-name-re %))
#(gen'/string-from-regex docker-image-name-re)))

(def docker-tag-re (re-pattern "[-\\w.]+"))

(s/def ::docker-tag
(s/with-gen
(s/and ::non-blank-string
#(re-matches docker-tag-re %))
#(gen'/string-from-regex docker-tag-re)))

(s/def ::base-image-tag ::docker-image-name)

(s/def ::distro qualified-keyword?)
(def distro-component-re (re-pattern "[-_A-Za-z][-\\w.]+"))

(s/def ::distro
(s/with-gen
(s/and qualified-keyword?
#(->> %
((juxt namespace name))
((fn [elements]
(every? (fn [e] (re-matches distro-component-re e))
elements)))))
#(gen/fmap (fn [[namespace local]] (keyword namespace local))
(gen/vector (gen'/string-from-regex distro-component-re) 2))))

(s/def ::distros (s/coll-of ::distro :distinct true :into #{}))

(s/def ::build-tool (s/or ::specific-tool ::non-blank-string
::all-tools #(= ::core/all %)))
(s/def ::specific-build-tool #{"lein" "tools-deps"})
(s/def ::build-tool (s/or ::specific-tool ::specific-build-tool
::all-tools #{::core/all}))
(s/def ::specific-build-tool-version
(s/with-gen
(s/and ::non-blank-string
#(re-matches #"(?:\d+\.)+\d+" %))
#(gen/fmap (fn [nums] (str/join "." nums))
(gen/vector (gen/int) 2 4))))

(s/def ::build-tool-version
(s/nilable (s/and ::non-blank-string #(re-matches #"[\d\.]+" %))))
(s/def ::build-tools (s/map-of ::build-tool ::build-tool-version))
(s/nilable ::specific-build-tool-version))

(s/def ::build-tool-versions
(s/map-of ::specific-build-tool ::specific-build-tool-version))

(s/def ::maintainers
(s/coll-of ::non-blank-string :distinct true :into #{}))
(s/def ::maintainer ::non-blank-string)

(s/def ::architecture ::non-blank-string)
(s/def ::architecture #{"amd64" "arm64v8"})
(s/def ::architectures (s/coll-of ::architecture :distinct true :into #{}))

(def git-repo "https://github.com/Quantisan/docker-clojure.git")
Expand All @@ -55,14 +92,9 @@
"debian" #{:debian-slim/bookworm-slim :debian/bookworm
:debian-slim/bullseye-slim :debian/bullseye}})

(def default-architectures
(def architectures
#{"amd64" "arm64v8"})

(def distro-architectures
"Map of distro types to architectures it supports if different from
default-architectures."
{:alpine #{"amd64"}})

(def default-distros
"The default distro to use for tags that don't specify one, keyed by jdk-version.
:default is a fallback for jdk versions not o/w specified."
Expand All @@ -84,12 +116,13 @@
"1.12.0.1530" "2a113e3a4f1005e05f4d6a6dee24ca317b0115cdd7e6ca6155a76f5ffa5ba35b"}})

(def exclusions ; don't build these for whatever reason(s)
#{; no more jammy builds for JDK 23+
#{;; No more jammy builds for JDK 23+
{:jdk-version #(>= % 23)
:distro :ubuntu/jammy}
;; commented out example
#_{:jdk-version 8
:distro :alpine/alpine}})
;; No upstream ARM alpine images available before JDK 21
{:jdk-version #(< % 21)
:architecture "arm64v8"
:distro :alpine/alpine}})

(def maintainers
["Paul Lam <[email protected]> (@Quantisan)"
Expand Down
Loading
Loading