Skip to content

Commit 52822dd

Browse files
authored
Merge pull request #240 from Quantisan/feature/exclude-architectures
Feature: exclude architectures
2 parents a3924e8 + 7773c83 commit 52822dd

File tree

18 files changed

+698
-385
lines changed

18 files changed

+698
-385
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Install babashka
1212
uses: DeLaGuardo/[email protected]
1313
with:
14-
bb: 1.3.190
14+
bb: 1.12.199
1515
- uses: actions/checkout@v4
1616
- name: Check for stale Dockerfiles
1717
run: |

.github/workflows/official-images-pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1313
steps:
1414
- name: Install babashka
15-
uses: DeLaGuardo/setup-clojure@12.5
15+
uses: DeLaGuardo/setup-clojure@13.2
1616
with:
17-
bb: 1.3.190
17+
bb: 1.12.199
1818
- name: Checkout code
1919
uses: actions/checkout@v4
2020
- name: Generate manifest
@@ -67,7 +67,7 @@ jobs:
6767
github-username: ${{ github.actor }}
6868
token: ${{ secrets.API_TOKEN_GITHUB }}
6969
- name: Open official-images pull request
70-
uses: peter-evans/create-pull-request@v6
70+
uses: peter-evans/create-pull-request@v7
7171
with:
7272
token: ${{ secrets.API_TOKEN_GITHUB }}
7373
path: official-images

bb.edn

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
{:paths ["src"]
22
:deps {local/deps {:local/root "."}
33
org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
4-
:git/sha "951b49b8c173244e66443b8188e3ff928a0a71e7"}}
4+
:git/sha "b6eb0f2208ab036c0a5d0e7235cb0b09d2feabb7"}}
55
:tasks
6-
{:requires ([docker-clojure.core :as dc])
6+
{:requires ([babashka.deps :as deps]
7+
[docker-clojure.core :as dc])
78
clean (dc/-main "clean")
89
dockerfiles {:depends [clean]
910
:task (apply dc/-main "dockerfiles" *command-line-args*)}
1011
manifest (apply dc/-main "manifest" *command-line-args*)
1112
build-images {:task (apply dc/-main "build-images" *command-line-args*)}
12-
test {:extra-paths ["test"]
13-
:requires ([docker-clojure.test-runner :as tr])
14-
:task (tr/-main 'docker-clojure.core-test 'docker-clojure.dockerfile-test
15-
'docker-clojure.manifest-test)}}}
13+
test (deref (deps/clojure '-X:test))}}

deps.edn

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{:deps
22
{org.clojure/clojure {:mvn/version "1.12.0"}
33
org.clojure/math.combinatorics {:mvn/version "0.3.0"}
4-
org.clojure/core.async {:mvn/version "1.6.681"}}
4+
org.clojure/core.async {:mvn/version "1.8.741"}
5+
com.gfredericks/test.chuck {:git/url "https://github.com/gfredericks/test.chuck"
6+
:git/sha "3e129a11ce9cc1a57584fa022b9b05ab7546a609"}}
57

68
:paths ["src" "resources"]
79

@@ -11,7 +13,8 @@
1113
:parallelization 2}}
1214

1315
:test {:extra-paths ["test"]
14-
:extra-deps {com.cognitect/test-runner
15-
{:git/url "https://github.com/cognitect-labs/test-runner.git"
16-
:sha "9d36f36ff541dac680a05010e4348c744333f191"}}
17-
:main-opts ["-m" "cognitect.test-runner"]}}}
16+
:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}
17+
orchestra/orchestra {:mvn/version "2021.01.01-1"}
18+
org.clojure/test.check {:mvn/version "1.1.1"}}
19+
:exec-fn docker-clojure.fix-kaocha/run-tests
20+
:exec-args {}}}}

src/docker_clojure/config.clj

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
(ns docker-clojure.config
22
(:require [clojure.spec.alpha :as s]
3+
[clojure.spec.gen.alpha :as gen]
34
[clojure.string :as str]
5+
[com.gfredericks.test.chuck.generators :as gen']
46
[docker-clojure.core :as-alias core]))
57

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

16-
(s/def ::docker-image-name (s/and ::non-blank-string
17-
#(re-matches #"[-\w]+(?::[-\w.]+)?" %)))
18-
(s/def ::docker-tag (s/and ::non-blank-string
19-
#(re-matches #"[-\w.]+" %)))
18+
(def docker-image-name-re (re-pattern "[-\\w]+(?::[-\\w.]+)?"))
19+
20+
(s/def ::docker-image-name
21+
(s/with-gen
22+
(s/and ::non-blank-string
23+
#(re-matches docker-image-name-re %))
24+
#(gen'/string-from-regex docker-image-name-re)))
25+
26+
(def docker-tag-re (re-pattern "[-\\w.]+"))
27+
28+
(s/def ::docker-tag
29+
(s/with-gen
30+
(s/and ::non-blank-string
31+
#(re-matches docker-tag-re %))
32+
#(gen'/string-from-regex docker-tag-re)))
33+
2034
(s/def ::base-image-tag ::docker-image-name)
2135

22-
(s/def ::distro qualified-keyword?)
36+
(def distro-component-re (re-pattern "[-_A-Za-z][-\\w.]+"))
37+
38+
(s/def ::distro
39+
(s/with-gen
40+
(s/and qualified-keyword?
41+
#(->> %
42+
((juxt namespace name))
43+
((fn [elements]
44+
(every? (fn [e] (re-matches distro-component-re e))
45+
elements)))))
46+
#(gen/fmap (fn [[namespace local]] (keyword namespace local))
47+
(gen/vector (gen'/string-from-regex distro-component-re) 2))))
48+
2349
(s/def ::distros (s/coll-of ::distro :distinct true :into #{}))
2450

25-
(s/def ::build-tool (s/or ::specific-tool ::non-blank-string
26-
::all-tools #(= ::core/all %)))
51+
(s/def ::specific-build-tool #{"lein" "tools-deps"})
52+
(s/def ::build-tool (s/or ::specific-tool ::specific-build-tool
53+
::all-tools #{::core/all}))
54+
(s/def ::specific-build-tool-version
55+
(s/with-gen
56+
(s/and ::non-blank-string
57+
#(re-matches #"(?:\d+\.)+\d+" %))
58+
#(gen/fmap (fn [nums] (str/join "." nums))
59+
(gen/vector (gen/int) 2 4))))
60+
2761
(s/def ::build-tool-version
28-
(s/nilable (s/and ::non-blank-string #(re-matches #"[\d\.]+" %))))
29-
(s/def ::build-tools (s/map-of ::build-tool ::build-tool-version))
62+
(s/nilable ::specific-build-tool-version))
63+
64+
(s/def ::build-tool-versions
65+
(s/map-of ::specific-build-tool ::specific-build-tool-version))
3066

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

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

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

58-
(def default-architectures
95+
(def architectures
5996
#{"amd64" "arm64v8"})
6097

61-
(def distro-architectures
62-
"Map of distro types to architectures it supports if different from
63-
default-architectures."
64-
{:alpine #{"amd64"}})
65-
6698
(def default-distros
6799
"The default distro to use for tags that don't specify one, keyed by jdk-version.
68100
:default is a fallback for jdk versions not o/w specified."
@@ -84,12 +116,13 @@
84116
"1.12.0.1530" "2a113e3a4f1005e05f4d6a6dee24ca317b0115cdd7e6ca6155a76f5ffa5ba35b"}})
85117

86118
(def exclusions ; don't build these for whatever reason(s)
87-
#{; no more jammy builds for JDK 23+
119+
#{;; No more jammy builds for JDK 23+
88120
{:jdk-version #(>= % 23)
89121
:distro :ubuntu/jammy}
90-
;; commented out example
91-
#_{:jdk-version 8
92-
:distro :alpine/alpine}})
122+
;; No upstream ARM alpine images available before JDK 21
123+
{:jdk-version #(< % 21)
124+
:architecture "arm64v8"
125+
:distro :alpine/alpine}})
93126

94127
(def maintainers
95128
["Paul Lam <[email protected]> (@Quantisan)"

0 commit comments

Comments
 (0)