mirror of https://github.com/linkerd/linkerd2.git
Add bin/git-commit-proxy-version (#3071)
Each time we update the proxy from the linkerd2-proxy repo, we make the
change slightly differently. The bin/git-commit-proxy-version does all the
steps needed to update the proxy version up to and including making a
commit to this repo.
The proxy version is now stored in a .proxy-version file and is
consumed directly by Dockerfile-proxy, which both simplifies the
Dockerfile and the update process.
This script formats commit messages and emits output as follows:
```
commit c05198a851f69bdc7007974a0ef1f4c01c98d0ce (HEAD -> ver/proxy-update)
Author: Oliver Gould <ver@buoyant.io>
Date: Thu Jul 11 17:23:05 2019 +0000
proxy: Update to linkerd/linkerd2-proxy#3a3ec3b
* linkerd/linkerd2-proxy#0cc58cd fallback: Clarify fallback layering (linkerd/linkerd2-proxy#288)
* linkerd/linkerd2-proxy#b71349a Replace `log` and `env-logger` with `tracing` and `tracing-fmt` (linkerd/linkerd2-proxy#277)
* linkerd/linkerd2-proxy#3a3ec3b Use a constant-time load balancer (linkerd/linkerd2-proxy#266)
diff --git a/.proxy-version b/.proxy-version
index f81f40de..d7faa12d 100644
--- a/.proxy-version
+++ b/.proxy-version
@@ -1 +1 @@
-05b012d
+3a3ec3b
```
This commit is contained in:
parent
f8aff8c23d
commit
38597083eb
|
|
@ -0,0 +1 @@
|
|||
05b012d
|
||||
|
|
@ -4,11 +4,9 @@ FROM gcr.io/linkerd-io/base:2019-02-19.01 as fetch
|
|||
RUN apt-get update && apt-get install -y ca-certificates
|
||||
WORKDIR /build
|
||||
COPY bin/fetch-proxy bin/fetch-proxy
|
||||
ARG PROXY_VERSION
|
||||
RUN (proxy=$(bin/fetch-proxy $PROXY_VERSION) && \
|
||||
version=$(basename "$proxy" | sed 's/linkerd2-proxy-//') && \
|
||||
mv "$proxy" linkerd2-proxy && \
|
||||
echo "$version" >version.txt)
|
||||
COPY .proxy-version proxy-version
|
||||
RUN (proxy=$(bin/fetch-proxy $(cat proxy-version)) && \
|
||||
mv "$proxy" linkerd2-proxy)
|
||||
|
||||
## compile proxy-identity agent
|
||||
FROM gcr.io/linkerd-io/go-deps:4c8f4294 as golang
|
||||
|
|
@ -23,7 +21,7 @@ RUN CGO_ENABLED=0 GOOS=linux go install ./proxy-identity
|
|||
|
||||
FROM $RUNTIME_IMAGE as runtime
|
||||
COPY --from=fetch /build/target/proxy/LICENSE /usr/lib/linkerd/LICENSE
|
||||
COPY --from=fetch /build/version.txt /usr/lib/linkerd/linkerd2-proxy-version.txt
|
||||
COPY --from=fetch /build/proxy-version /usr/lib/linkerd/linkerd2-proxy-version.txt
|
||||
COPY --from=fetch /build/linkerd2-proxy /usr/lib/linkerd/linkerd2-proxy
|
||||
COPY --from=golang /go/bin/proxy-identity /usr/lib/linkerd/linkerd2-proxy-identity
|
||||
COPY proxy-identity/run-proxy.sh /usr/bin/linkerd2-proxy-run
|
||||
|
|
|
|||
|
|
@ -13,17 +13,15 @@ rootdir="$( cd $bindir/.. && pwd )"
|
|||
. $bindir/_docker.sh
|
||||
. $bindir/_tag.sh
|
||||
|
||||
dockerfile=$rootdir/Dockerfile-proxy
|
||||
dockerfile="$rootdir/Dockerfile-proxy"
|
||||
|
||||
validate_go_deps_tag $dockerfile
|
||||
validate_go_deps_tag "$dockerfile"
|
||||
|
||||
(
|
||||
$bindir/docker-build-base
|
||||
$bindir/docker-build-go-deps
|
||||
) >/dev/null
|
||||
|
||||
# Default to a pinned commit SHA of the proxy.
|
||||
PROXY_VERSION="${PROXY_VERSION:-05b012d}"
|
||||
|
||||
tag="$(head_root_tag)"
|
||||
docker_build proxy $tag $dockerfile --build-arg LINKERD_VERSION=$tag --build-arg PROXY_VERSION=$PROXY_VERSION
|
||||
docker_build proxy "$tag" "$dockerfile" \
|
||||
--build-arg "LINKERD_VERSION=$tag"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "usage: $(basename $0) PROXY-REVISION" >&2
|
||||
exit 64
|
||||
fi
|
||||
new_proxy_revision="$1"
|
||||
|
||||
bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
rootdir="$( cd $bindir/.. && pwd )"
|
||||
|
||||
old_proxy_version="$(tr -d '\n' <"$rootdir/.proxy-version")"
|
||||
if [ -z "$old_proxy_version" ]; then
|
||||
echo "missing .proxy-version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Checkout the linkerd2-proxy repo to resolve the new proxy version to a SHA
|
||||
# and obtain the commit log since the prior version.
|
||||
tmp=$(mktemp -d -t l2-proxy.XXX)
|
||||
git clone --depth=100 https://github.com/linkerd/linkerd2-proxy "$tmp"
|
||||
cd "$tmp"
|
||||
|
||||
sha="$(git rev-parse "${new_proxy_revision}")"
|
||||
new_proxy_version="${sha:0:7}"
|
||||
|
||||
if ! git-rev-parse --verify --quiet "${old_proxy_version}" ; then
|
||||
echo "The old proxy-version ${old_proxy_version} does not exist in the last 100 proxy commits." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "proxy: Update proxy to ${new_proxy_revision}" >"$tmp/commit.template"
|
||||
echo "" >>"$tmp/commit.template"
|
||||
|
||||
git log --pretty=oneline --abbrev-commit --reverse "${old_proxy_version}..${new_proxy_version}" | \
|
||||
sed -E -e 's,^,* linkerd/linkerd2-proxy#,' \
|
||||
-e 's, \((#[0-9]+)\), (linkerd/linkerd2-proxy\1),' \
|
||||
>>"$tmp/commit.template"
|
||||
|
||||
cd "$rootdir"
|
||||
echo "$new_proxy_version" >"$rootdir/.proxy-version"
|
||||
|
||||
git commit --file="$tmp/commit.template" --edit -- "$rootdir/.proxy-version"
|
||||
|
||||
rm -rf "$tmp"
|
||||
|
||||
git --no-pager show HEAD
|
||||
Loading…
Reference in New Issue