Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rosetta/test build rosetta dockerfile in ci #5635

Merged
merged 34 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ff0b721
run-docker-build-from-artifacts Trigger docker build + release from b…
lk86 Aug 12, 2020
a5aa3bd
run-docker-build-from-artifacts Add CODA_VERSION to DOCKER_DEPLOY_ENV
lk86 Aug 13, 2020
f9fe08b
run-docker-build-from-artifacts Use rebuild-deb to make a more comple…
lk86 Aug 13, 2020
292e0fd
run-docker-build-from-artifacts Simplify extra-args
lk86 Aug 13, 2020
9804d24
run-docker-build-from-artifacts Quote version and service just in case
lk86 Aug 13, 2020
b20dde4
run-docker-build-from-artifacts Be more verbose and add rosetta support
lk86 Aug 13, 2020
7b61c1e
run-docker-build-from-artifacts Fix bash syntax
lk86 Aug 13, 2020
0312bff
run-docker-build-from-artifacts Fix flags for docker builds from publ…
lk86 Aug 13, 2020
9fcdfb2
run-docker-build-from-artifacts Remove + from docker tag as its inval…
lk86 Aug 13, 2020
99dbb24
run-docker-build-from-artifacts Sanitize docker image tags
lk86 Aug 13, 2020
51ca606
run-docker-build-from-artifacts Fix CODA_VERSION
lk86 Aug 13, 2020
dded5c9
run-docker-build-from-artifacts Be more selective about building rose…
lk86 Aug 13, 2020
ef3a744
run-docker-build-from-artifacts Use buildkite_branch
lk86 Aug 13, 2020
2350976
run-docker-build-from-artifacts Also use buildkite_branch for deb builds
lk86 Aug 13, 2020
064d607
run-docker-build-from-artifacts Use buildkite_branch more consistently
lk86 Aug 13, 2020
aea40d9
rosetta/test-build-rosetta-dockerfile-in-ci Use buildkite_branch for …
lk86 Aug 13, 2020
fbaa4cf
rosetta/test-build-rosetta-dockerfile-in-ci Fix bash syntax
lk86 Aug 13, 2020
543cb2a
rosetta/test-build-rosetta-dockerfile-in-ci Dont escape buildkite_bra…
lk86 Aug 13, 2020
082ab4c
rosetta/test-build-rosetta-dockerfile-in-ci Dont escape buildkite_bra…
lk86 Aug 13, 2020
3581d38
rosetta/test-build-rosetta-dockerfile-in-ci Try out a quicker iterati…
lk86 Aug 13, 2020
5ff92a9
rosetta/test-build-rosetta-dockerfile-in-ci Remove force-yes due to d…
lk86 Aug 13, 2020
dc107f7
rosetta/test-build-rosetta-dockerfile-in-ci Try DOCKER_DEPLOY_ENV aga…
lk86 Aug 13, 2020
df65d90
rosetta/test-build-rosetta-dockerfile-in-ci Sanitize BUILDKITE_BRANCH…
lk86 Aug 13, 2020
a00ddf7
rosetta/test-build-rosetta-dockerfile-in-ci Disbale docker_deploy_env…
lk86 Aug 13, 2020
2b87dad
rosetta/test-build-rosetta-dockerfile-in-ci Make sure rosetta=true wo…
lk86 Aug 13, 2020
590829a
rosetta/test-build-rosetta-dockerfile-in-ci Use a case statement buil…
lk86 Aug 13, 2020
cdd9110
rosetta/test-build-rosetta-dockerfile-in-ci Go back to the DEPLOY_ENV…
lk86 Aug 13, 2020
78d5a49
rosetta/test-build-rosetta-dockerfile-in-ci Centralize git env in a s…
lk86 Aug 13, 2020
b3dd02a
rosetta/test-build-rosetta-dockerfile-in-ci Improve consistency in sy…
lk86 Aug 13, 2020
64e7108
rosetta/test-build-rosetta-dockerfile-in-ci Dont calculate pvhash twi…
lk86 Aug 13, 2020
8507462
rosetta/test-build-rosetta-dockerfile-in-ci Fix path to coda in expor…
lk86 Aug 13, 2020
47e7e7b
Merge branch 'develop' into rosetta/test-build-rosetta-dockerfile-in-ci
mergify[bot] Aug 13, 2020
556e087
rosetta/test-build-rosetta-dockerfile-in-ci Hardcode buildkite path i…
lk86 Aug 13, 2020
467b6b4
rosetta/test-build-rosetta-dockerfile-in-ci Add back /tmp/DOCKER_DEPL…
lk86 Aug 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions buildkite/scripts/docker-artifact.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#!/bin/bash
set -eo pipefail
set +x

source DOCKER_DEPLOY_ENV

extra_args="--build-arg coda_version=${CODA_DEB_VERSION} --build-arg deb_repo=${CODA_DEB_REPO}"
echo "--- Build/Release docker artifact for coda-daemon"
scripts/release-docker.sh --service "${CODA_SERVICE}" --version "${CODA_VERSION}"\
--extra-args "--build-arg coda_version=${CODA_DEB_VERSION} --build-arg deb_repo=${CODA_DEB_REPO}"

echo "--- Build/Release docker artifact"
scripts/release-docker.sh --service $CODA_SERVICE --version $CODA_VERSION --extra-args "${extra_args}"
if [[ -n $CODA_BUILD_ROSETTA ]]; then
echo "--- Build/Release coda-rosetta to docker hub"
scripts/release-docker.sh --service "coda-rosetta" --version "${CODA_VERSION}"\
--extra-args "--build-arg DUNE_PROFILE=dev --build-arg CODA_BRANCH=${CODA_GIT_BRANCH}"
fi
37 changes: 37 additions & 0 deletions buildkite/scripts/export-git-env-vars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -eo pipefail

set +x
echo "Exporting Variables: "

export GITHASH=$(git rev-parse --short=7 HEAD)
export GITBRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD | sed 's!/!-!; s!_!-!g' )
export GITTAG=$(git describe --abbrev=0)


# Identify All Artifacts by Branch and Git Hash
set +u
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"

export PVKEYHASH=$(${SCRIPTPATH}/../../_build/default/src/app/cli/src/coda.exe internal snark-hashes | sort | md5sum | cut -c1-8)

export PROJECT="coda-$(echo "$DUNE_PROFILE" | tr _ -)"

export BUILD_NUM=${BUILDKITE_BUILD_NUM}
export BUILD_URL=${BUILDKITE_BUILD_URL}

[[ -n "$BUILDKITE_BRANCH" ]] && export GITBRANCH=$(echo "$BUILDKITE_BRANCH" | sed 's!/!-!; s!_!-!g')

if [[ "$BUILDKITE_BRANCH" == "master" ]]; then
export VERSION="${GITTAG}-${GITHASH}"
export DOCKER_TAG="$(echo "${VERSION}" | sed 's!/!-!; s!_!-!g')"
else
export VERSION="${GITTAG}+${BUILD_NUM}-${GITBRANCH}-${GITHASH}-PV${PVKEYHASH}"
export DOCKER_TAG="$(echo "${GITTAG}-${GITBRANCH}" | sed 's!/!-!g; s!_!-!g')"
fi

case $BUILDKITE_BRANCH in master|develop|rosetta*)
export BUILD_ROSETTA=true
esac

set -x
19 changes: 17 additions & 2 deletions buildkite/scripts/publish-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,23 @@ esac
echo "Publishing debs: ${DEBS}"
set -x
${DEBS3} --codename "${CODENAME}" "${DEBS}"
set +x
echo "Exporting Variables: "
# Export Variables for Downstream Steps
echo "export CODA_DEB_REPO=$CODENAME" >> ./DOCKER_DEPLOY_ENV

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
source "${SCRIPTPATH}/export-git-env-vars.sh"

set -x
# Export variables for use with downstream steps
echo "export CODA_SERVICE=coda-daemon" >> ./DOCKER_DEPLOY_ENV
echo "export CODA_VERSION=${DOCKER_TAG}" >> ./DOCKER_DEPLOY_ENV
echo "export CODA_DEB_VERSION=${VERSION}" >> ./DOCKER_DEPLOY_ENV
echo "export CODA_PROJECT=${PROJECT}" >> ./DOCKER_DEPLOY_ENV
echo "export CODA_GIT_HASH=${GITHASH}" >> ./DOCKER_DEPLOY_ENV
echo "export CODA_GIT_BRANCH=${BUILDKITE_BRANCH}" >> ./DOCKER_DEPLOY_ENV
echo "export CODA_GIT_TAG=${GITTAG}" >> ./DOCKER_DEPLOY_ENV
echo "export CODA_DEB_REPO=${CODENAME}" >> ./DOCKER_DEPLOY_ENV
echo "export CODA_WAS_PUBLISHED=true" >> ./DOCKER_DEPLOY_ENV
echo "export CODA_BUILD_ROSETTA=${BUILD_ROSETTA}" >> ./DOCKER_DEPLOY_ENV
set +x

6 changes: 5 additions & 1 deletion buildkite/src/Jobs/Artifact.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ let OpamInit = ../Command/OpamInit.dhall
let Summon = ../Command/Summon/Type.dhall
let Size = ../Command/Size.dhall
let Libp2p = ../Command/Libp2pHelperBuild.dhall
let DockerArtifact = ../Command/DockerArtifact.dhall

let dependsOn = [ { name = "Artifact", key = "artifacts-build" } ]

in
Pipeline.build
Expand Down Expand Up @@ -39,6 +42,7 @@ Pipeline.build
label = "Build artifacts",
key = "artifacts-build",
target = Size.Large
}
},
DockerArtifact.generateStep dependsOn
]
}
8 changes: 5 additions & 3 deletions dockerfiles/Dockerfile-coda-daemon
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ FROM ubuntu:18.04
# Run with `docker build --build-arg coda_version=<version>`
ARG coda_version
ARG deb_repo=stable

ENV DEBIAN_FRONTEND noninteractive
RUN echo "Building image with version $coda_version"

# Dependencies
RUN apt-get -y update && \
DEBIAN_FRONTEND=noninteractive apt-get -y upgrade && \
DEBIAN_FRONTEND=noninteractive apt-get -y install \
apt-get -y upgrade && \
apt-get -y install \
strace \
dumb-init \
libssl1.1 \
Expand All @@ -24,7 +26,7 @@ RUN apt-get -y update && \
# coda package
RUN echo "deb [trusted=yes] http://packages.o1test.net $deb_repo main" > /etc/apt/sources.list.d/coda.list \
&& apt-get update \
&& apt-get install --force-yes coda-testnet-postake-medium-curves=$coda_version -y
&& apt-get install -y "coda-testnet-postake-medium-curves=$coda_version"

WORKDIR /root

Expand Down
28 changes: 3 additions & 25 deletions scripts/rebuild-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,11 @@
set -euo pipefail

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
cd "${SCRIPTPATH}/../_build"

GITHASH=$(git rev-parse --short=7 HEAD)
GITBRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD | sed 's!/!-!; s!_!-!g' )
GITTAG=$(git describe --abbrev=0)

# Identify All Artifacts by Branch and Git Hash
set +u
PVKEYHASH=$(./default/src/app/cli/src/coda.exe internal snark-hashes | sort | md5sum | cut -c1-8)

PROJECT="coda-$(echo "$DUNE_PROFILE" | tr _ -)"

BUILD_NUM=${BUILDKITE_BUILD_NUM}
BUILD_URL=${BUILDKITE_BUILD_URL}
# Load in env vars for githash/branch/etc.
source "${SCRIPTPATH}/../buildkite/scripts/export-git-env-vars.sh"

if [ "$GITBRANCH" == "master" ]; then
VERSION="${GITTAG}-${GITHASH}"
else
VERSION="${GITTAG}+${BUILD_NUM}-${GITBRANCH}-${GITHASH}-PV${PVKEYHASH}"
fi

# Export variables for use with downstream steps
echo "export CODA_DEB_VERSION=$VERSION" >> /tmp/DOCKER_DEPLOY_ENV
echo "export CODA_PROJECT=$PROJECT" >> /tmp/DOCKER_DEPLOY_ENV
echo "export CODA_GIT_HASH=$GITHASH" >> /tmp/DOCKER_DEPLOY_ENV
echo "export CODA_GIT_BRANCH=$GITBRANCH" >> /tmp/DOCKER_DEPLOY_ENV
echo "export CODA_GIT_TAG=$GITTAG" >> /tmp/DOCKER_DEPLOY_ENV
cd "${SCRIPTPATH}/../_build"

BUILDDIR="deb_build"

Expand Down
10 changes: 8 additions & 2 deletions scripts/release-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
# we have to trustlist and configure image builds individually because each one is going to be slightly different.
# This is needed as opposed to trusting the structure of the each project to be consistent for every deployable.

set -e+x
set -e
set +x

CLEAR='\033[0m'
RED='\033[0;31m'
# Array of valid service names
VALID_SERVICES=('coda-daemon' 'bot' 'coda-demo')
VALID_SERVICES=('coda-daemon' 'bot' 'coda-demo' 'coda-rosetta')

function usage() {
if [ -n "$1" ]; then
Expand Down Expand Up @@ -53,6 +54,11 @@ coda-demo)
DOCKERFILE_PATH="dockerfiles/Dockerfile-coda-demo"
DOCKER_CONTEXT="."
;;
coda-rosetta)
DOCKERFILE_PATH="dockerfiles/Dockerfile-rosetta"
mkdir some_empty_dir
DOCKER_CONTEXT="./some_empty_dir"
;;
*)
esac

Expand Down