Merge pull request #5265 from jeffhappily/update-docker-build

Update docker build
This commit is contained in:
Emanuel Borsboom 2020-04-12 11:45:26 -07:00 committed by GitHub
commit 286bdeea57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 5 deletions

View File

@ -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 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.
For an LTS minor bump, you'll typically want to:

View File

@ -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