From c45ea76fe57fbd3955227f86638c7c01690dda94 Mon Sep 17 00:00:00 2001 From: Jeff Happily Date: Fri, 27 Mar 2020 17:21:06 +0800 Subject: [PATCH 1/3] Modify logic to allow building old version --- automated/dockerfiles/build.sh | 41 +++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/automated/dockerfiles/build.sh b/automated/dockerfiles/build.sh index d80d4823..3709664f 100755 --- a/automated/dockerfiles/build.sh +++ b/automated/dockerfiles/build.sh @@ -90,10 +90,36 @@ case "$LTS_SLUG_ARG" in ;; esac +# +# Determine if lts slug is latest +# + +SNAPSHOTS="$(mktemp "lts-snapshots.json.XXXXXX")" +trap "rm -f \"$SNAPSHOTS\"" EXIT +wget -qO- https://www.stackage.org/download/lts-snapshots.json >"$SNAPSHOTS" + LTS_VERSION="${LTS_SLUG#lts-}" LTS_MAJOR="${LTS_VERSION%.*}" LTS_MINOR="${LTS_VERSION#*.}" +# +# Determine latest LTS version +# + +LATEST_LTS_SLUG=$(jq -r ".[\"lts\"]" $SNAPSHOTS) +LATEST_LTS_VERSION="${LATEST_LTS_SLUG#lts-}" +LATEST_LTS_MAJOR="${LATEST_LTS_VERSION%.*}" +LATEST_LTS_MINOR="${LATEST_LTS_VERSION#*.}" + +# +# Determine latest minor version of the selected major version +# + +MAJOR_LATEST_LTS_SLUG=$(jq -r ".[\"lts-$LTS_MAJOR\"]" $SNAPSHOTS) +MAJOR_LATEST_LTS_VERSION="${MAJOR_LATEST_LTS_SLUG#lts-}" +MAJOR_LATEST_LTS_MAJOR="${MAJOR_LATEST_LTS_VERSION%.*}" +MAJOR_LATEST_LTS_MINOR="${MAJOR_LATEST_LTS_VERSION#*.}" + # # Find the Dockerfile for the selected snapshot # @@ -128,9 +154,14 @@ fi # Create and push additional tags # -# Create and push an 'lts-X' tag. -tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:lts-$LTS_MAJOR" +# If we select the latest minor version for the selected major version, then +# also create and push an 'lts-X' tag. +if [[ $LTS_MINOR -ge $MAJOR_LATEST_LTS_MINOR ]]; then + tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:lts-$LTS_MAJOR" +fi -# Create and push the 'lts' and 'latest' tags. -tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:lts" -tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:latest" +# If we selected the latest LTS snapshot, also create and push the 'lts' and 'latest' tags. +if [[ "$LTS_MAJOR" = "$LATEST_LTS_MAJOR" ]] && [[ $LTS_MINOR -ge $LATEST_LTS_MINOR ]]; then + tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:lts" + tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:latest" +fi From 9e105dd5ed88d1873f528149c2afbfe63c519808 Mon Sep 17 00:00:00 2001 From: Jeff Happily Date: Fri, 27 Mar 2020 17:56:08 +0800 Subject: [PATCH 2/3] Add message for LTS minor release --- CURATORS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CURATORS.md b/CURATORS.md index 0fa768d2..42ce5bae 100644 --- a/CURATORS.md +++ b/CURATORS.md @@ -294,6 +294,8 @@ problems on nightly or LTS major, you need to fix build-constraints.yaml (see info above). ### Building LTS minor releases +Before running the build, please make sure that the Dockerfile in `automated/dockerfiles/lts-X.Y` is up to date, where X is the major version that you're building and Y is the latest minor version of X. If any changes need to be made, (eg, new GHC version), copy `lts-X.Y/Dockerfile` to `lts-X.Z/Dockerfile`, where Z is the minor version you're building, and include the new changes. + First run `build.sh` to regenerate updated `ltsXX/work/constraints.yaml` and `ltsXX/work/snapshot-incomplete.yaml` files. For an LTS minor bump, you'll typically want to: From 82cc9d3f15a8a1ed3f85668e4321cacc388a4ee1 Mon Sep 17 00:00:00 2001 From: Jeff Happily Date: Mon, 30 Mar 2020 21:33:08 +0800 Subject: [PATCH 3/3] Modify message --- CURATORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CURATORS.md b/CURATORS.md index 42ce5bae..94baf7bf 100644 --- a/CURATORS.md +++ b/CURATORS.md @@ -294,7 +294,7 @@ problems on nightly or LTS major, you need to fix build-constraints.yaml (see info above). ### Building LTS minor releases -Before running the build, please make sure that the Dockerfile in `automated/dockerfiles/lts-X.Y` is up to date, where X is the major version that you're building and Y is the latest minor version of X. If any changes need to be made, (eg, new GHC version), copy `lts-X.Y/Dockerfile` to `lts-X.Z/Dockerfile`, where Z is the minor version you're building, and include the new changes. +Before running the build, please make sure that the Dockerfile in `automated/dockerfiles/lts-X.Y` is up to date, where X is the major version that you're building and Y is the latest minor version of X for which a Dockerfile exists. If any changes need to be made, (eg, new GHC version), copy `lts-X.Y/Dockerfile` to `lts-X.Z/Dockerfile`, where Z is the minor version you're building, and include the new changes. First run `build.sh` to regenerate updated `ltsXX/work/constraints.yaml` and `ltsXX/work/snapshot-incomplete.yaml` files.