Skip to content

Commit

Permalink
Switch from hash to tag (#2287)
Browse files Browse the repository at this point in the history
* switch from hash to tag

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
  • Loading branch information
sabau authored and fedekunze committed Apr 1, 2019
1 parent 571ac5c commit 32f6103
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 27 deletions.
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
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/*

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

0 comments on commit 32f6103

Please sign in to comment.