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

Switch from hash to tag #2287

Merged
merged 21 commits into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
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
15 changes: 6 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,31 +124,28 @@ jobs:
paths:
- app/dist

# Build Gaia from the SDK source code specified by tasks/build/Gaia/COMMIT.sh.
# Build Gaia from the SDK source code specified by tasks/build/Gaia/VERSION
buildGaia:
executor: go
steps:
- checkout
- restore_cache:
key: v8-Gaia-{{ checksum "tasks/build/Gaia/COMMIT.sh" }}

# If Gaia isn't in the cache then build it.
key: v8-gaia-{{ checksum "tasks/build/Gaia/VERSION" }}
- run: |
if [ ! -d /tmp/gaia ]; then
cd tasks/build/Gaia
. ./COMMIT.sh
TARGET=/tmp/gaia PLATFORM=linux ./build.sh
TAG=`cat ./VERSION` TARGET=/tmp/gaia PLATFORM=linux ./build.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why linux only?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It runs on top of alpine so it's the only supported OS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that documented somewhere ?

Copy link
Contributor Author

@sabau sabau Mar 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's maybe not that straightforward now that you ask.
we are using the official circleci/golang:1.11
that is built on top of golang:1.11.1
that is built on top of alpine:3.8

but the nice idea was to remove all of those and the build too, and simply use
tendermint/gaia:<TAG>

fi
- save_cache:
key: v8-Gaia-{{ checksum "tasks/build/Gaia/COMMIT.sh" }}
key: v8-gaia-{{ checksum "tasks/build/Gaia/VERSION" }}
paths:
- *GAIA
- persist_to_workspace:
root: *GAIA
paths:
- "*"
# - store_artifacts:
# path: builds/Gaia/linux_amd64/*
- store_artifacts:
path: builds/Gaia/linux_amd64/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why linux?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the circle ci environment docker we run in is linux I suppose


pendingUpdated:
executor: node
Expand Down
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Changed] [\#2287](https://github.com/cosmos/voyager/pull/2287) Use tags instead of commit hash @sabau
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Open the Docker App and build the Gaia CLI (`gaiacli`) and the full node (`gaiad
yarn build:gaia
```

The version built is specified in `tasks/build/Gaia/COMMIT.sh` and the programs are placed in the `builds/Gaia` directory.
The version built is specified in `tasks/build/Gaia/VERSION` and the programs are placed in the `builds/Gaia` directory.

### Testnets

Expand Down
5 changes: 0 additions & 5 deletions tasks/build/Gaia/COMMIT.sh

This file was deleted.

1 change: 1 addition & 0 deletions tasks/build/Gaia/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.33.0
5 changes: 2 additions & 3 deletions tasks/build/Gaia/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ mkdir --parents $GOPATH/src/github.com/cosmos
cd $GOPATH/src/github.com/cosmos
git clone https://github.com/cosmos/cosmos-sdk
cd cosmos-sdk
git checkout $COMMIT
git checkout $TAG
echo ###############################################################################
echo Installing development tools.
echo ###############################################################################
make devtools
make tools

# Build Gaia for each platform.

Expand All @@ -20,7 +20,6 @@ for GOOS in $platforms; do
echo ###############################################################################
echo Building Cosmos SDK for $GOOS platform.
echo ###############################################################################
make get_vendor_deps
make install

if [ "$GOOS" = "linux" ]; then
Expand Down
10 changes: 5 additions & 5 deletions tasks/build/Gaia/localBuild.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

. ./COMMIT.sh
version="$(pwd)/../../../builds/GaiaVersions/$COMMIT"
export TAG=`cat ./VERSION`
version="$(pwd)/../../../builds/GaiaVersions/$TAG"
source="$(pwd)/../../../builds/Gaia"
mkdir -p "$version"
rm -rf "$source"
Expand All @@ -15,15 +15,15 @@ case "${unameOut}" in
esac

if [[ -f "$version/${PLATFORM}_amd64/gaiad" ]]; then
echo "Already built $COMMIT for $PLATFORM"
echo "Already built $TAG for $PLATFORM"
else
echo "Building new version: $COMMIT for $PLATFORM "
echo "Building new version: $TAG for $PLATFORM "

export TARGET=/mnt

docker run \
--interactive \
--env COMMIT \
--env TAG \
--env TARGET \
--env PLATFORM \
--mount type=bind,source="$version",target="$TARGET" \
Expand Down
2 changes: 1 addition & 1 deletion tasks/build/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
git clone /mnt/.git .
git checkout $COMMIT
git checkout $TAG
yarn install
ln --symbolic /mnt/builds
node tasks/build/build.js "$@"
6 changes: 3 additions & 3 deletions tasks/build/localBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const path = require(`path`)
const untildify = require(`untildify`)

const optionsSpecification = {
commit: [`commit from which to build`],
tag: [`git tag from which to build`],
network: [`name of the default network to use`]
}

Expand All @@ -26,7 +26,7 @@ cli(optionsSpecification, async options => {
execSync(`yarn run build:gaia`)
}

const { commit } = options
const { tag } = options

// Build the container that we'll use to build Voyager.
execSync(`docker build --tag cosmos/voyager-builder .`, {
Expand All @@ -53,7 +53,7 @@ cli(optionsSpecification, async options => {

execSync(
`docker run \
--env COMMIT=${commit} \
--env TAG=${tag} \
--interactive \
--mount type=bind,readonly,source=${resolved.git},target=/mnt/.git \
--mount type=bind,source=${resolved.builds},target=/mnt/builds \
Expand Down