diff --git a/.gitignore b/.gitignore index b1a1c67b9..6a588e21f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.glide/ +.glide .work/ .vscode/ diff --git a/build/cross-image/Dockerfile b/build/cross-image/Dockerfile index c7f1a0a83..ced8571fd 100644 --- a/build/cross-image/Dockerfile +++ b/build/cross-image/Dockerfile @@ -23,6 +23,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ curl \ docker.io \ git \ + jq \ libxml2-dev \ llvm-dev \ mingw-w64 \ @@ -53,11 +54,6 @@ RUN ACBUILD_VERSION=0.4.0 && \ curl -fsSLO https://github.com/containers/build/releases/download/v${ACBUILD_VERSION}/acbuild-v${ACBUILD_VERSION}.tar.gz && \ tar -C /usr/local/bin --strip-components=1 -xzf acbuild-v${ACBUILD_VERSION}.tar.gz -#install github-release -RUN GITHUB_RELEASE_VERSION=0.6.2 && \ - curl -fsSLO https://github.com/aktau/github-release/releases/download/v${GITHUB_RELEASE_VERSION}/linux-amd64-github-release.tar.bz2 && \ - tar -C /usr/local/bin --strip-components=3 -xjf linux-amd64-github-release.tar.bz2 - # # install multi-arch packages needed to build ceph # diff --git a/build/cross-image/version b/build/cross-image/version index 8294c1843..7693c96bf 100644 --- a/build/cross-image/version +++ b/build/cross-image/version @@ -1 +1 @@ -0.1.2 \ No newline at end of file +0.1.3 \ No newline at end of file diff --git a/build/makelib/release.mk b/build/makelib/release.mk index 6fb694efe..3348e740f 100644 --- a/build/makelib/release.mk +++ b/build/makelib/release.mk @@ -28,7 +28,7 @@ RELEASE_CLIENT_ONLY_PLATFORMS ?= RELEASE_HOST_PLATFORM ?= $(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH) # Optional. the flavors to release -RELEASE_FLAVORS := binaries docker aci +RELEASE_FLAVORS := binaries docker # Optional. Github token repo and user GITHUB_TOKEN ?= diff --git a/build/release/common.sh b/build/release/common.sh index c25bead85..35919f7ff 100644 --- a/build/release/common.sh +++ b/build/release/common.sh @@ -1,7 +1,5 @@ #!/bin/bash -e -ghargs="-u ${GITHUB_USER} -r ${GITHUB_REPO} -t ${RELEASE_VERSION}" - get_bindir() { local os=$1 local arch=$2 @@ -29,15 +27,30 @@ layout_root() { cp /etc/ssl/certs/ca-certificates.crt $dir/root/etc/ssl/certs } +github_get_release_id() { + curl -4 -s -H "Authorization: token ${GITHUB_TOKEN}" \ + "https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/tags/${RELEASE_VERSION}" | jq -r '.id' +} + github_check_release() { - if ! github-release info ${ghargs} > /dev/null 2>&1; then - echo "ERROR: github release tag ${version} was not found. Did you create the release?" 1>&2 + id=$(github_get_release_id) + + if [[ ${id} == "null" ]]; then + echo "ERROR: github release tag ${RELEASE_VERSION} was not found. Did you create the release?" 1>&2 return 1; fi } github_upload() { - local file=$1 - github-release upload ${ghargs} -n $(basename $file) -f $file -} + local filepath=$1 + local mediatype=$2 + local filename=$(basename $filepath) + id=$(github_get_release_id) + + curl -4 -s -H "Authorization: token ${GITHUB_TOKEN}" \ + -H "Accept: application/vnd.github.manifold-preview" \ + -H "Content-Type: application/${mediatype}" \ + --data-binary @${filepath} \ + "https://uploads.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/${id}/assets?name=${filename}" +} diff --git a/build/release/docker.sh b/build/release/docker.sh index 823e98f0b..4982e822d 100755 --- a/build/release/docker.sh +++ b/build/release/docker.sh @@ -3,7 +3,7 @@ scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source ${scriptdir}/common.sh -container=quantum/castle +container=quantum/castled build() { local type=$1 @@ -30,7 +30,7 @@ EOF fi echo building docker container ${tag} - docker build -t ${tag} $tmpdir + docker build -t ${tag} -t quay.io/${tag} $tmpdir rm -fr $tmpdir } @@ -50,6 +50,9 @@ publish() { echo pushing docker container ${tag} docker push ${tag} + + echo pushing docker container quay.io/${tag} + docker push quay.io/${tag} } action=$1 diff --git a/build/run b/build/run index 2ac695122..36f68b665 100755 --- a/build/run +++ b/build/run @@ -44,12 +44,18 @@ fi tty -s && TTY_ARGS=-ti || TTY_ARGS= +if [ -z "${DISABLE_HOST_NETWORK}" ]; then + NET_ARGS="--net=host" +fi + if [ -z "${DISABLE_NESTED_DOCKER}" ]; then DOCKER_NESTED_ARGS="\ -v ${HOME}/.docker/config.json:${BUILDER_HOME}/.docker/config.json \ -v /var/run/docker.sock:/var/run/docker.sock" fi +# NOTE: docker seems more reliable when running with net=host. + docker run \ --rm \ --name "${friendly_name}" \ @@ -64,6 +70,7 @@ docker run \ ${NETRC_ARGS} \ ${USER_ARGS} \ ${DOCKER_NESTED_ARGS} \ + ${NET_ARGS} \ -v ${scriptdir}/../bin:${BUILDER_HOME}/go/bin \ -v ${scriptdir}/../.work/cross/pkg:${BUILDER_HOME}/go/pkg \ -v ${scriptdir}/..:${BUILDER_HOME}/go/src/github.com/quantum/castle \ diff --git a/circle.yml b/circle.yml index 128893c72..fdef7f9cb 100644 --- a/circle.yml +++ b/circle.yml @@ -5,6 +5,7 @@ machine: NPROCS: $(( ($(grep -c ^processor /proc/cpuinfo) + 1) / 2 )) CCACHE_DIR: ${HOME}/.ccache DISABLE_NESTED_DOCKER: 1 + DISABLE_HOST_NETWORK: 1 checkout: pre: