Bump ubuntu image in docker
This commit is contained in:
parent
31a5ec5c71
commit
70b3e5c999
1 changed files with 132 additions and 132 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
(ns gen-ci
|
(ns gen-ci
|
||||||
(:require
|
(:require
|
||||||
[babashka.tasks :as tasks]
|
[babashka.tasks :as tasks]
|
||||||
[clj-yaml.core :as yaml]
|
[clj-yaml.core :as yaml]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[flatland.ordered.map :refer [ordered-map]]))
|
[flatland.ordered.map :refer [ordered-map]]))
|
||||||
|
|
||||||
(def graalvm-version "22")
|
(def graalvm-version "22")
|
||||||
|
|
||||||
|
|
@ -39,71 +39,71 @@
|
||||||
[shorted?]
|
[shorted?]
|
||||||
(gen-job shorted?
|
(gen-job shorted?
|
||||||
(ordered-map
|
(ordered-map
|
||||||
:resource_class "large"
|
:resource_class "large"
|
||||||
:docker [{:image "circleci/clojure:lein-2.9.8"}]
|
:docker [{:image "circleci/clojure:lein-2.9.8"}]
|
||||||
:working_directory "~/repo"
|
:working_directory "~/repo"
|
||||||
:environment {:LEIN_ROOT "true"}
|
:environment {:LEIN_ROOT "true"}
|
||||||
:steps (gen-steps
|
:steps (gen-steps
|
||||||
shorted?
|
shorted?
|
||||||
[:checkout
|
[:checkout
|
||||||
(pull-submodules)
|
(pull-submodules)
|
||||||
{:restore_cache {:keys ["v1-dependencies-{{ checksum \"project.clj\" }}"
|
{:restore_cache {:keys ["v1-dependencies-{{ checksum \"project.clj\" }}"
|
||||||
"v1-dependencies-"]}}
|
"v1-dependencies-"]}}
|
||||||
{:run ".circleci/script/deploy"}
|
{:run ".circleci/script/deploy"}
|
||||||
{:save_cache {:paths ["~/.m2"]
|
{:save_cache {:paths ["~/.m2"]
|
||||||
:key "v1-dependencies-{{ checksum \"project.clj\" }}"}}]))))
|
:key "v1-dependencies-{{ checksum \"project.clj\" }}"}}]))))
|
||||||
|
|
||||||
(defn docker
|
(defn docker
|
||||||
[shorted?]
|
[shorted?]
|
||||||
(gen-job
|
(gen-job
|
||||||
shorted?
|
shorted?
|
||||||
(ordered-map
|
(ordered-map
|
||||||
:machine {:image "ubuntu-2004:202111-01"}
|
:machine {:image "ubuntu-2004:2024.05.1"}
|
||||||
:steps
|
:steps
|
||||||
(gen-steps
|
(gen-steps
|
||||||
shorted?
|
shorted?
|
||||||
[:checkout
|
[:checkout
|
||||||
(pull-submodules)
|
(pull-submodules)
|
||||||
"setup-docker-buildx"
|
"setup-docker-buildx"
|
||||||
{:attach_workspace {:at "/tmp"}}
|
{:attach_workspace {:at "/tmp"}}
|
||||||
(run "Build uberjar" "script/uberjar")
|
(run "Build uberjar" "script/uberjar")
|
||||||
{:run
|
{:run
|
||||||
{:name "Build Docker image"
|
{:name "Build Docker image"
|
||||||
:environment {:PLATFORMS "linux/amd64,linux/arm64"}
|
:environment {:PLATFORMS "linux/amd64,linux/arm64"}
|
||||||
:command
|
:command
|
||||||
"java -jar ./target/babashka-$(cat resources/BABASHKA_VERSION)-standalone.jar .circleci/script/docker.clj"}}]))))
|
"java -jar ./target/babashka-$(cat resources/BABASHKA_VERSION)-standalone.jar .circleci/script/docker.clj"}}]))))
|
||||||
|
|
||||||
(defn jvm
|
(defn jvm
|
||||||
[shorted? graalvm-home]
|
[shorted? graalvm-home]
|
||||||
(gen-job
|
(gen-job
|
||||||
shorted?
|
shorted?
|
||||||
(ordered-map
|
(ordered-map
|
||||||
:docker [{:image "circleci/clojure:openjdk-11-lein-2.9.8-bullseye"}]
|
:docker [{:image "circleci/clojure:openjdk-11-lein-2.9.8-bullseye"}]
|
||||||
:working_directory "~/repo"
|
:working_directory "~/repo"
|
||||||
:environment {:LEIN_ROOT "true"
|
:environment {:LEIN_ROOT "true"
|
||||||
:BABASHKA_PLATFORM "linux"
|
:BABASHKA_PLATFORM "linux"
|
||||||
:GRAALVM_VERSION graalvm-version
|
:GRAALVM_VERSION graalvm-version
|
||||||
:GRAALVM_HOME graalvm-home
|
:GRAALVM_HOME graalvm-home
|
||||||
:BABASHKA_TEST_ENV "jvm"}
|
:BABASHKA_TEST_ENV "jvm"}
|
||||||
:resource_class "large"
|
:resource_class "large"
|
||||||
:steps
|
:steps
|
||||||
(gen-steps
|
(gen-steps
|
||||||
shorted?
|
shorted?
|
||||||
[:checkout
|
[:checkout
|
||||||
(pull-submodules)
|
(pull-submodules)
|
||||||
{:restore_cache {:keys ["v1-dependencies-{{ checksum \"project.clj\" }}-{{ checksum \"deps.edn\" }}"
|
{:restore_cache {:keys ["v1-dependencies-{{ checksum \"project.clj\" }}-{{ checksum \"deps.edn\" }}"
|
||||||
"v1-dependencies-"]}}
|
"v1-dependencies-"]}}
|
||||||
(run "Install Clojure" "sudo script/install-clojure")
|
(run "Install Clojure" "sudo script/install-clojure")
|
||||||
(run "Download GraalVM" "script/install-graalvm")
|
(run "Download GraalVM" "script/install-graalvm")
|
||||||
(run
|
(run
|
||||||
"Run JVM tests"
|
"Run JVM tests"
|
||||||
"export BABASHKA_FEATURE_JDBC=true
|
"export BABASHKA_FEATURE_JDBC=true
|
||||||
export BABASHKA_FEATURE_POSTGRESQL=true
|
export BABASHKA_FEATURE_POSTGRESQL=true
|
||||||
script/test\nscript/run_lib_tests")
|
script/test\nscript/run_lib_tests")
|
||||||
(run "Run as lein command" ".circleci/script/lein")
|
(run "Run as lein command" ".circleci/script/lein")
|
||||||
(run
|
(run
|
||||||
"Create uberjar"
|
"Create uberjar"
|
||||||
"mkdir -p /tmp/release
|
"mkdir -p /tmp/release
|
||||||
script/uberjar
|
script/uberjar
|
||||||
VERSION=$(cat resources/BABASHKA_VERSION)
|
VERSION=$(cat resources/BABASHKA_VERSION)
|
||||||
jar=target/babashka-$VERSION-standalone.jar
|
jar=target/babashka-$VERSION-standalone.jar
|
||||||
|
|
@ -114,10 +114,10 @@ java -jar $jar script/reflection.clj
|
||||||
reflection=\"babashka-$VERSION-reflection.json\"
|
reflection=\"babashka-$VERSION-reflection.json\"
|
||||||
java -jar \"$jar\" --config .build/bb.edn --deps-root . release-artifact \"$jar\"
|
java -jar \"$jar\" --config .build/bb.edn --deps-root . release-artifact \"$jar\"
|
||||||
java -jar \"$jar\" --config .build/bb.edn --deps-root . release-artifact \"$reflection\"")
|
java -jar \"$jar\" --config .build/bb.edn --deps-root . release-artifact \"$reflection\"")
|
||||||
{:store_artifacts {:path "/tmp/release"
|
{:store_artifacts {:path "/tmp/release"
|
||||||
:destination "release"}}
|
:destination "release"}}
|
||||||
{:save_cache {:paths ["~/.m2"]
|
{:save_cache {:paths ["~/.m2"]
|
||||||
:key "v1-dependencies-{{ checksum \"project.clj\" }}-{{ checksum \"deps.edn\" }}"}}]))))
|
:key "v1-dependencies-{{ checksum \"project.clj\" }}-{{ checksum \"deps.edn\" }}"}}]))))
|
||||||
|
|
||||||
(defn unix
|
(defn unix
|
||||||
[shorted? static? musl? arch executor-conf resource-class graalvm-home platform]
|
[shorted? static? musl? arch executor-conf resource-class graalvm-home platform]
|
||||||
|
|
@ -149,46 +149,46 @@ java -jar \"$jar\" --config .build/bb.edn --deps-root . release-artifact \"$refl
|
||||||
""))]
|
""))]
|
||||||
(gen-job shorted?
|
(gen-job shorted?
|
||||||
(merge
|
(merge
|
||||||
executor-conf
|
executor-conf
|
||||||
(ordered-map
|
(ordered-map
|
||||||
:working_directory "~/repo"
|
:working_directory "~/repo"
|
||||||
:environment env
|
:environment env
|
||||||
:resource_class resource-class
|
:resource_class resource-class
|
||||||
:steps (gen-steps shorted?
|
:steps (gen-steps shorted?
|
||||||
(filter some?
|
(filter some?
|
||||||
[:checkout
|
[:checkout
|
||||||
(when (contains? #{"linux" "linux-aarch64"} platform)
|
(when (contains? #{"linux" "linux-aarch64"} platform)
|
||||||
(run "Check max glibc version" "script/check_glibc.sh"))
|
(run "Check max glibc version" "script/check_glibc.sh"))
|
||||||
{:attach_workspace {:at "/tmp"}}
|
{:attach_workspace {:at "/tmp"}}
|
||||||
(run "Pull Submodules" "git submodule init\ngit submodule update")
|
(run "Pull Submodules" "git submodule init\ngit submodule update")
|
||||||
{:restore_cache
|
{:restore_cache
|
||||||
{:keys [cache-key]}}
|
{:keys [cache-key]}}
|
||||||
(when (= "mac" platform)
|
(when (= "mac" platform)
|
||||||
(run "Install Rosetta" "sudo /usr/sbin/softwareupdate --install-rosetta --agree-to-license"))
|
(run "Install Rosetta" "sudo /usr/sbin/softwareupdate --install-rosetta --agree-to-license"))
|
||||||
(run "Install Clojure" "sudo script/install-clojure")
|
(run "Install Clojure" "sudo script/install-clojure")
|
||||||
(when (= "mac" platform)
|
(when (= "mac" platform)
|
||||||
(run "Install Leiningen" "script/install-leiningen"))
|
(run "Install Leiningen" "script/install-leiningen"))
|
||||||
(when (not= "mac" platform)
|
(when (not= "mac" platform)
|
||||||
(run "Install native dev tools"
|
(run "Install native dev tools"
|
||||||
(if (and static? musl? (not= "aarch64" arch))
|
(if (and static? musl? (not= "aarch64" arch))
|
||||||
(str base-install-cmd "\nsudo -E script/setup-musl")
|
(str base-install-cmd "\nsudo -E script/setup-musl")
|
||||||
base-install-cmd)))
|
base-install-cmd)))
|
||||||
(run "Download GraalVM" "script/install-graalvm")
|
(run "Download GraalVM" "script/install-graalvm")
|
||||||
#_(run "Download iprof" "curl -sLO 'https://github.com/babashka/pgo-profiles/releases/download/2023.10.11/default.iprof'")
|
#_(run "Download iprof" "curl -sLO 'https://github.com/babashka/pgo-profiles/releases/download/2023.10.11/default.iprof'")
|
||||||
(run "Build binary" (if (= "aarch64" arch)
|
(run "Build binary" (if (= "aarch64" arch)
|
||||||
"script/uberjar\nscript/compile -H:PageSize=64K # --pgo=default.iprof"
|
"script/uberjar\nscript/compile -H:PageSize=64K # --pgo=default.iprof"
|
||||||
"script/uberjar\nscript/compile # --pgo=default.iprof") "30m")
|
"script/uberjar\nscript/compile # --pgo=default.iprof") "30m")
|
||||||
(run "Run tests" "script/test\nscript/run_lib_tests")
|
(run "Run tests" "script/test\nscript/run_lib_tests")
|
||||||
(run "Release" ".circleci/script/release")
|
(run "Release" ".circleci/script/release")
|
||||||
{:persist_to_workspace {:root "/tmp"
|
{:persist_to_workspace {:root "/tmp"
|
||||||
:paths ["release"]}}
|
:paths ["release"]}}
|
||||||
{:save_cache
|
{:save_cache
|
||||||
{:paths ["~/.m2" "~/graalvm"]
|
{:paths ["~/.m2" "~/graalvm"]
|
||||||
:key cache-key}}
|
:key cache-key}}
|
||||||
{:store_artifacts {:path "/tmp/release"
|
{:store_artifacts {:path "/tmp/release"
|
||||||
:destination "release"}}
|
:destination "release"}}
|
||||||
(run "Publish artifact link to Slack"
|
(run "Publish artifact link to Slack"
|
||||||
"./bb .circleci/script/publish_artifact.clj || true")])))))))
|
"./bb .circleci/script/publish_artifact.clj || true")])))))))
|
||||||
|
|
||||||
(defn make-config
|
(defn make-config
|
||||||
[shorted?]
|
[shorted?]
|
||||||
|
|
@ -198,35 +198,35 @@ java -jar \"$jar\" --config .build/bb.edn --deps-root . release-artifact \"$refl
|
||||||
linux-graalvm-home (str "/home/circleci/graalvm-" graalvm-version)
|
linux-graalvm-home (str "/home/circleci/graalvm-" graalvm-version)
|
||||||
mac-graalvm-home (format "/Users/distiller/graalvm-%s/Contents/Home" graalvm-version)]
|
mac-graalvm-home (format "/Users/distiller/graalvm-%s/Contents/Home" graalvm-version)]
|
||||||
(ordered-map
|
(ordered-map
|
||||||
:version 2.1
|
:version 2.1
|
||||||
:commands
|
:commands
|
||||||
{:setup-docker-buildx
|
{:setup-docker-buildx
|
||||||
{:steps
|
{:steps
|
||||||
[{:run
|
[{:run
|
||||||
{:name "Create multi-platform capabale buildx builder"
|
{:name "Create multi-platform capabale buildx builder"
|
||||||
:command
|
:command
|
||||||
"docker run --privileged --rm tonistiigi/binfmt --install all\ndocker buildx create --name ci-builder --use"}}]}}
|
"docker run --privileged --rm tonistiigi/binfmt --install all\ndocker buildx create --name ci-builder --use"}}]}}
|
||||||
:jobs (ordered-map
|
:jobs (ordered-map
|
||||||
:jvm (jvm shorted? linux-graalvm-home)
|
:jvm (jvm shorted? linux-graalvm-home)
|
||||||
:linux (unix shorted? false false "amd64" docker-executor-conf "large" linux-graalvm-home "linux")
|
:linux (unix shorted? false false "amd64" docker-executor-conf "large" linux-graalvm-home "linux")
|
||||||
:linux-static
|
:linux-static
|
||||||
(unix shorted? true true "amd64" docker-executor-conf "large" linux-graalvm-home "linux")
|
(unix shorted? true true "amd64" docker-executor-conf "large" linux-graalvm-home "linux")
|
||||||
:linux-aarch64-static
|
:linux-aarch64-static
|
||||||
(unix shorted? true false "aarch64" machine-executor-conf "arm.large" linux-graalvm-home "linux")
|
(unix shorted? true false "aarch64" machine-executor-conf "arm.large" linux-graalvm-home "linux")
|
||||||
:mac (unix shorted? false false "amd64" mac-executor-conf "macos.m1.medium.gen1" mac-graalvm-home "mac")
|
:mac (unix shorted? false false "amd64" mac-executor-conf "macos.m1.medium.gen1" mac-graalvm-home "mac")
|
||||||
:deploy (deploy shorted?)
|
:deploy (deploy shorted?)
|
||||||
:docker (docker shorted?))
|
:docker (docker shorted?))
|
||||||
:workflows (ordered-map
|
:workflows (ordered-map
|
||||||
:version 2
|
:version 2
|
||||||
:ci {:jobs ["jvm"
|
:ci {:jobs ["jvm"
|
||||||
"linux"
|
"linux"
|
||||||
"linux-static"
|
"linux-static"
|
||||||
"mac"
|
"mac"
|
||||||
"linux-aarch64-static"
|
"linux-aarch64-static"
|
||||||
{:deploy {:filters {:branches {:only "master"}}
|
{:deploy {:filters {:branches {:only "master"}}
|
||||||
:requires ["jvm" "linux"]}}
|
:requires ["jvm" "linux"]}}
|
||||||
{:docker {:filters {:branches {:only "master"}}
|
{:docker {:filters {:branches {:only "master"}}
|
||||||
:requires ["linux" "linux-static" "linux-aarch64-static"]}}]}))))
|
:requires ["linux" "linux-static" "linux-aarch64-static"]}}]}))))
|
||||||
|
|
||||||
(def skip-config
|
(def skip-config
|
||||||
{:skip-if-only [#".*.md$"
|
{:skip-if-only [#".*.md$"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue