Skip to content

Commit

Permalink
Merge pull request #7714 from glevand/for-merge-cross
Browse files Browse the repository at this point in the history
Add multi arch release support
  • Loading branch information
xiang90 authored Apr 21, 2017
2 parents 8bad78c + bf98718 commit a9087ee
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 13 deletions.
11 changes: 11 additions & 0 deletions Dockerfile-release.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM aarch64/ubuntu:16.04

ADD etcd /usr/local/bin/
ADD etcdctl /usr/local/bin/
ADD var/etcd /var/etcd
ADD var/lib/etcd /var/lib/etcd

EXPOSE 2379 2380

# Define default command.
CMD ["/usr/local/bin/etcd"]
4 changes: 2 additions & 2 deletions Dockerfile-release.ppc64le
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ FROM ppc64le/ubuntu:16.04

ADD etcd /usr/local/bin/
ADD etcdctl /usr/local/bin/
RUN mkdir -p /var/etcd/
RUN mkdir -p /var/lib/etcd/
ADD var/etcd /var/etcd
ADD var/lib/etcd /var/lib/etcd

EXPOSE 2379 2380

Expand Down
3 changes: 2 additions & 1 deletion Documentation/v2/dev/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ cd release
# personal GPG is okay for now
for i in etcd-*{.zip,.tar.gz}; do gpg --sign ${i}; done
# use `CoreOS ACI Builder <release@coreos.com>` secret key
gpg -u 88182190 -a --output etcd-${VERSION}-linux-amd64.aci.asc --detach-sig etcd-${VERSION}-linux-amd64.aci
for aci in etcd-${VERSION}.*.aci; do gpg -u 88182190 -a --output ${aci}.asc --detach-sig ${aci}; done
```

## Publish Release Page in GitHub
Expand All @@ -88,6 +88,7 @@ gpg -u 88182190 -a --output etcd-${VERSION}-linux-amd64.aci.asc --detach-sig etc
```
docker login quay.io
docker push quay.io/coreos/etcd:${VERSION}
docker push quay.io/coreos/etcd:${VERSION}-${arch}
```

- Add `latest` tag to the new image on [quay.io](https://quay.io/repository/coreos/etcd?tag=latest&tab=tags) if this is a stable release.
Expand Down
11 changes: 10 additions & 1 deletion scripts/build-aci
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ ACBUILD=${ACBUILD:-acbuild}

VERSION=$1

go2aci() {
case "${1}" in
"arm64") echo "aarch64";;
*) echo "${1}";;
esac
}

if ! command -v $ACBUILD >/dev/null; then
echo "acbuild ($ACBUILD) is not executable"
exit 1
Expand Down Expand Up @@ -63,11 +70,13 @@ acbuild --debug port add peer tcp 2380

acbuild --debug copy "$TMPHOSTS" /etc/hosts

acbuild --debug label add arch $(go2aci ${GOARCH})

# mkdir default data-dir
mkdir -p .acbuild/currentaci/rootfs/var/lib/etcd

# symlinks for backward-compatibility
ln -s ./usr/local/bin/etcd .acbuild/currentaci/rootfs/etcd
ln -s ./usr/local/bin/etcdctl .acbuild/currentaci/rootfs/etcdctl

acbuild --debug write --overwrite $BUILDDIR/etcd-${1}-linux-amd64.aci
acbuild --debug write --overwrite $BUILDDIR/etcd-${1}-linux-${GOARCH}.aci
1 change: 1 addition & 0 deletions scripts/build-binary
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function main {
TARGET_ARCHS=("amd64")

if [ ${GOOS} == "linux" ]; then
TARGET_ARCHS+=("arm64")
TARGET_ARCHS+=("ppc64le")
fi

Expand Down
12 changes: 8 additions & 4 deletions scripts/build-docker
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env bash

set -e

if [ "$#" -ne 1 ]; then
echo "Usage: $0 VERSION" >&2
exit 1
fi

VERSION=${1}
ARCH=$(go env GOARCH)
DOCKERFILE="Dockerfile-release"
TAG="quay.io/coreos/etcd"
: ${TAG:="quay.io/coreos/etcd"}

if [ -z ${BINARYDIR} ]; then
RELEASE="etcd-${1}"-`go env GOOS`-`go env GOARCH`
Expand All @@ -24,17 +27,18 @@ fi

if [ ${ARCH} != "amd64" ]; then
DOCKERFILE+=".${ARCH}"
TAG+="-${ARCH}"
VERSION+="-${ARCH}"
fi

BINARYDIR=${BINARYDIR:-.}
BUILDDIR=${BUILDDIR:-.}

IMAGEDIR=${BUILDDIR}/image-docker

mkdir -p ${IMAGEDIR}
mkdir -p ${IMAGEDIR}/var/etcd
mkdir -p ${IMAGEDIR}/var/lib/etcd
cp ${BINARYDIR}/etcd ${BINARYDIR}/etcdctl ${IMAGEDIR}

cat ./${DOCKERFILE} > ${IMAGEDIR}/Dockerfile

docker build -t ${TAG}:${1} ${IMAGEDIR}
docker build -t ${TAG}:${VERSION} ${IMAGEDIR}
16 changes: 11 additions & 5 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#
set -e

ARCH=$(go env GOARCH)
VERSION=$1
if [ -z "${VERSION}" ]; then
echo "Usage: ${0} VERSION" >> /dev/stderr
Expand All @@ -27,8 +26,15 @@ ETCD_ROOT=$(dirname "${BASH_SOURCE}")/..
pushd ${ETCD_ROOT} >/dev/null
echo Building etcd binary...
./scripts/build-binary ${VERSION}
echo Building aci image...
BINARYDIR=release/etcd-${VERSION}-linux-amd64 BUILDDIR=release ./scripts/build-aci ${VERSION}
echo Building docker image...
BINARYDIR=release/etcd-${VERSION}-linux-${ARCH} BUILDDIR=release ./scripts/build-docker ${VERSION}

# ppc64le not yet supported by acbuild.
for TARGET_ARCH in "amd64" "arm64"; do
echo Building ${TARGET_ARCH} aci image...
GOARCH=${TARGET_ARCH} BINARYDIR=release/etcd-${VERSION}-linux-${TARGET_ARCH} BUILDDIR=release ./scripts/build-aci ${VERSION}
done

for TARGET_ARCH in "amd64" "arm64" "ppc64le"; do
echo Building ${TARGET_ARCH} docker image...
GOARCH=${TARGET_ARCH} BINARYDIR=release/etcd-${VERSION}-linux-${TARGET_ARCH} BUILDDIR=release ./scripts/build-docker ${VERSION}
done
popd >/dev/null

0 comments on commit a9087ee

Please sign in to comment.