mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #3935 from dgonyeo/master
scripts: rewrote build-aci to use acbuild
This commit is contained in:
commit
45de4e918e
@ -1,18 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
BINARYDIR=${BINARYDIR:-bin}
|
BINARYDIR=${BINARYDIR:-bin}
|
||||||
BUILDDIR=${BUILDDIR:-bin}
|
BUILDDIR=${BUILDDIR:-bin}
|
||||||
|
|
||||||
# A non-installed actool can be used, for example:
|
# A non-installed acbuild can be used, for example:
|
||||||
# ACTOOL=../../appc/spec/bin/actool
|
# ACBUILD=../../appc/acbuild/bin/acbuild
|
||||||
ACTOOL=${ACTOOL:-actool}
|
ACBUILD=${ACBUILD:-acbuild}
|
||||||
|
|
||||||
IMAGEDIR=${IMAGEDIR:-$BUILDDIR/image-aci}
|
|
||||||
|
|
||||||
VERSION=$1
|
VERSION=$1
|
||||||
|
|
||||||
if ! command -v $ACTOOL >/dev/null; then
|
if ! command -v $ACBUILD >/dev/null; then
|
||||||
echo "actool ($ACTOOL) is not executable"
|
echo "acbuild ($ACBUILD) is not executable"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -26,79 +26,41 @@ if [ -z "$VERSION" ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p $IMAGEDIR/rootfs
|
acbuild --debug begin
|
||||||
if [ ! -d $IMAGEDIR/rootfs -o ! -x $IMAGEDIR/rootfs ]; then
|
|
||||||
echo "$IMAGEDIR/rootfs is not a writeable directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$(ls -A $IMAGEDIR/rootfs)" ]; then
|
TMPHOSTS="$(mktemp)"
|
||||||
echo "$IMAGEDIR/rootfs is not empty"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp $BINARYDIR/etcd $BINARYDIR/etcdctl $IMAGEDIR/rootfs/
|
acbuildEnd() {
|
||||||
cp README.md $IMAGEDIR/rootfs/
|
rm "$TMPHOSTS"
|
||||||
cp etcdctl/README.md $IMAGEDIR/rootfs/README-etcdctl.md
|
export EXIT=$?
|
||||||
cp -r Documentation $IMAGEDIR/rootfs/
|
acbuild --debug end && exit $EXIT
|
||||||
|
|
||||||
cat <<DF > $IMAGEDIR/manifest
|
|
||||||
{
|
|
||||||
"acVersion": "0.5.1",
|
|
||||||
"acKind": "ImageManifest",
|
|
||||||
"name": "coreos.com/etcd",
|
|
||||||
"labels": [
|
|
||||||
{"name": "os", "value": "linux"},
|
|
||||||
{"name": "arch", "value": "amd64"},
|
|
||||||
{"name": "version", "value": "${VERSION}"}
|
|
||||||
],
|
|
||||||
"app": {
|
|
||||||
"environment": [
|
|
||||||
{
|
|
||||||
"name": "ETCD_DATA_DIR",
|
|
||||||
"value": "/data-dir"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"exec": [
|
|
||||||
"/etcd"
|
|
||||||
],
|
|
||||||
"user": "0",
|
|
||||||
"group": "0",
|
|
||||||
"mountPoints": [
|
|
||||||
{
|
|
||||||
"name": "data-dir",
|
|
||||||
"path": "/data-dir"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"ports": [
|
|
||||||
{
|
|
||||||
"name": "legacy-client",
|
|
||||||
"port": 4001,
|
|
||||||
"protocol": "tcp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "client",
|
|
||||||
"port": 2379,
|
|
||||||
"protocol": "tcp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "legacy-peer",
|
|
||||||
"port": 7001,
|
|
||||||
"protocol": "tcp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "peer",
|
|
||||||
"port": 2380,
|
|
||||||
"protocol": "tcp"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DF
|
trap acbuildEnd EXIT
|
||||||
|
|
||||||
mkdir -p $IMAGEDIR/rootfs/etc/
|
cat <<DF > $TMPHOSTS
|
||||||
cat <<DF > $IMAGEDIR/rootfs/etc/hosts
|
|
||||||
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
||||||
DF
|
DF
|
||||||
|
|
||||||
$ACTOOL build -overwrite=true $IMAGEDIR $BUILDDIR/etcd-${1}-linux-amd64.aci
|
acbuild --debug set-name coreos.com/etcd
|
||||||
|
|
||||||
|
acbuild --debug copy --to-dir $BINARYDIR/etcd $BINARYDIR/etcdctl /
|
||||||
|
acbuild --debug copy README.md /README.md
|
||||||
|
acbuild --debug copy etcdctl/README.md /README-etcdctl.md
|
||||||
|
acbuild --debug copy --to-dir Documentation /
|
||||||
|
|
||||||
|
acbuild --debug environment add ETCD_DATA_DIR /data-dir
|
||||||
|
|
||||||
|
acbuild --debug label add version "$VERSION"
|
||||||
|
|
||||||
|
acbuild --debug set-exec -- /etcd
|
||||||
|
|
||||||
|
acbuild --debug mount add data-dir /data-dir
|
||||||
|
|
||||||
|
acbuild --debug port add legacy-client tcp 4001
|
||||||
|
acbuild --debug port add legacy-peer tcp 7001
|
||||||
|
acbuild --debug port add client tcp 2379
|
||||||
|
acbuild --debug port add peer tcp 2380
|
||||||
|
|
||||||
|
acbuild --debug copy "$TMPHOSTS" /etc/hosts
|
||||||
|
|
||||||
|
acbuild --debug write --overwrite $BUILDDIR/etcd-${1}-linux-amd64.aci
|
||||||
|
Loading…
x
Reference in New Issue
Block a user