mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Selective releasing (#708)
* Rejig the build process During a build, we check and rebuild any dependencies prior to potentially using them. Build: - DIND (this only produces a new docker image, no local code changes) - fnserver (built as part of the testing) On master, if everything works, then we release the built artifacts, if necessary: - DIND (this pushes a docker image and a tag) - fnserver (this builds the docker image and releases it, if necessary). Fnserver is dealt with last by the release script: all previous steps in CI use locally-run go tests rather than a docker file. When a commit happens, we need to know (a) if we need to rebuild a set of tools and artifacts (or whether we can continue to use published ones); and (b) if we need to release new versions of those tools, if all tests pass. We do this by identifying the previous release tag on origin/master (which is the release branch), then checking for changes between that point at the current one. Those changes may appear in various places in the tree: some simple boolean rules work out whether the change means we need to rebuild and rerelease. * Make the fnproject/fnserver build use the latest dind As docker bumps from 17.12.x, use whatever dind we just built. * Use bash
This commit is contained in:
@@ -1,3 +1,17 @@
|
||||
set -ex
|
||||
|
||||
docker build --build-arg HTTPS_PROXY --build-arg HTTP_PROXY -t fnproject/dind:latest .
|
||||
|
||||
# Match version with Docker version
|
||||
version=$(docker run --rm -v "$PWD":/app treeder/bump --extract --input "`docker -v`")
|
||||
echo "Version: $version"
|
||||
M=$(docker run --rm treeder/bump --format M --input "$version")
|
||||
Mm=$(docker run --rm treeder/bump --format M.m --input "$version")
|
||||
|
||||
# Tag these up so that they're available for the local build process,
|
||||
# if necessary
|
||||
|
||||
docker tag fnproject/dind:latest fnproject/dind:$version
|
||||
# be nice to have bump image do all of this tagging and pushing too (mount docker sock and do it all)
|
||||
docker tag fnproject/dind:$version fnproject/dind:$Mm
|
||||
docker tag fnproject/dind:$version fnproject/dind:$M
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
set -ex
|
||||
#!/bin/bash
|
||||
|
||||
# ./build.sh
|
||||
set -exo pipefail
|
||||
|
||||
# Ensure working dir is clean
|
||||
git status
|
||||
if [[ -z $(git status -s) ]]
|
||||
then
|
||||
echo "tree is clean"
|
||||
else
|
||||
echo "tree is dirty, please commit changes before running this"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This script should be run after its sibliing, build.sh, and
|
||||
# after any related tests have passed.
|
||||
|
||||
# Match version with Docker version
|
||||
version=$(docker run --rm -v "$PWD":/app treeder/bump --extract --input "`docker -v`")
|
||||
@@ -8,12 +21,24 @@ echo "Version: $version"
|
||||
M=$(docker run --rm treeder/bump --format M --input "$version")
|
||||
Mm=$(docker run --rm treeder/bump --format M.m --input "$version")
|
||||
|
||||
# Calculate new release version
|
||||
DIND_NEW=$(echo "$DIND_PREV" | perl -pe 's/\d+\.\d+\.\K(\d+)/$1+1/e')
|
||||
|
||||
# Add appropriate docker tags
|
||||
docker tag fnproject/dind:latest fnproject/dind:$version
|
||||
# be nice to have bump image do all of this tagging and pushing too (mount docker sock and do it all)
|
||||
docker tag fnproject/dind:$version fnproject/dind:$Mm
|
||||
docker tag fnproject/dind:$version fnproject/dind:$M
|
||||
docker tag fnproject/dind:$version fnproject/dind:release-$DIND_NEW
|
||||
|
||||
docker push fnproject/dind:$version
|
||||
docker push fnproject/dind:$Mm
|
||||
docker push fnproject/dind:$M
|
||||
docker push fnproject/dind:release-$DIND_NEW
|
||||
docker push fnproject/dind:latest
|
||||
|
||||
# Mark this release with a tag
|
||||
# No code changes so only the tag requires a push
|
||||
git tag -f -a "$DIND_NEW" -m "DIND release $DIND_NEW of $version"
|
||||
git push origin "$DIND_NEW"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user