-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4133 from Agoric/mfig-docker-deployment-test
ci: schedule a Docker deployment test
- Loading branch information
Showing
18 changed files
with
290 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Agoric SDK restore Golang build | ||
description: 'Set up Golang environment and restore cached built files' | ||
|
||
inputs: | ||
go-version: | ||
description: 'The version of Go to use' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: set default environment variables | ||
run: echo GOPATH="$HOME/go" >> $GITHUB_ENV | ||
shell: bash | ||
- uses: actions/checkout@v2 | ||
with: | ||
clean: 'false' | ||
submodules: 'true' | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
- name: cache Go modules | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ env.GOPATH }}/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('packages/cosmic-swingset/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: go mod download | ||
run: go mod download | ||
shell: bash | ||
if: steps.built.outputs.cache-hit != 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Chain deployment test | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
deployment-test: | ||
runs-on: ubuntu-18.04 # trusty | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
clean: 'false' | ||
- uses: ./.github/actions/restore-golang | ||
with: | ||
go-version: 1.15 | ||
- uses: ./.github/actions/restore-node | ||
with: | ||
node-version: 14.x | ||
- name: Build cosmic-swingset dependencies | ||
run: | | ||
# Some of our build relies on /usr/src/agoric-sdk | ||
set -e | ||
sudo mv "$GITHUB_WORKSPACE" /usr/src/agoric-sdk | ||
ln -s /usr/src/agoric-sdk "$GITHUB_WORKSPACE" | ||
cd /usr/src/agoric-sdk/packages/cosmic-swingset | ||
make install | ||
working-directory: / | ||
- run: sudo ./packages/deployment/scripts/install-deps.sh | ||
working-directory: /usr/src/agoric-sdk | ||
- run: /usr/src/agoric-sdk/packages/deployment/scripts/integration-test.sh | ||
working-directory: ~ | ||
env: | ||
NETWORK_NAME: chaintest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../src/entrypoint.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#! /usr/bin/env node | ||
/* global process */ | ||
// Get a deployment.json for a 2-node docker setup. | ||
|
||
const DEFAULT_NUM_VALIDATORS = 2; | ||
const DEFAULT_NETWORK_NAME = 'localtest'; | ||
|
||
const NUM_VALIDATORS = process.argv[2] || DEFAULT_NUM_VALIDATORS; | ||
|
||
const NETWORK_NAME = process.env.NETWORK_NAME || DEFAULT_NETWORK_NAME; | ||
|
||
// Add in DOCKER_VOLUMES=host_path:container_path,host_path2:container_path2,... | ||
const ADD_VOLUMES = (process.env.DOCKER_VOLUMES || '') | ||
.split(',') | ||
.flatMap(volumeSpec => { | ||
const splitVolumeSpec = volumeSpec.split(':'); | ||
if (splitVolumeSpec.length < 2) { | ||
// No specification found. | ||
return []; | ||
} | ||
|
||
const [hostPath, ...rest] = splitVolumeSpec; | ||
return [ | ||
{ | ||
host_path: hostPath, | ||
container_path: rest.join(':'), | ||
}, | ||
]; | ||
}); | ||
|
||
const deployment = { | ||
PLACEMENTS: [ | ||
[ | ||
'docker1', | ||
{ | ||
default: 2, | ||
}, | ||
], | ||
], | ||
PLACEMENT_PROVIDER: { | ||
docker1: 'docker', | ||
}, | ||
SSH_PRIVATE_KEY_FILE: 'id_ecdsa', | ||
DETAILS: { | ||
VOLUMES: { | ||
docker1: [ | ||
{ | ||
host_path: '/sys/fs/cgroup', | ||
container_path: '/sys/fs/cgroup', | ||
}, | ||
...ADD_VOLUMES, | ||
], | ||
}, | ||
}, | ||
OFFSETS: { | ||
docker1: 0, | ||
}, | ||
ROLES: { | ||
docker1: 'validator', | ||
}, | ||
DATACENTERS: { | ||
docker1: new Array(NUM_VALIDATORS).fill('default'), | ||
}, | ||
PROVIDER_NEXT_INDEX: { | ||
docker: 1, | ||
}, | ||
NETWORK_NAME, | ||
}; | ||
|
||
process.stdout.write(`${JSON.stringify(deployment, null, 2)}\n`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#! /bin/bash | ||
set -ueo pipefail | ||
|
||
# Install Terraform. | ||
TERRAFORM_VERSION=0.11.14 | ||
|
||
uname_s=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
|
||
case $uname_s in | ||
*) TERRAFORM_OS=$uname_s ;; | ||
esac | ||
|
||
uname_m=$(uname -m) | ||
case $uname_m in | ||
x86_64) TERRAFORM_ARCH=amd64 ;; | ||
*) TERRAFORM_ARCH=$uname_m ;; | ||
esac | ||
|
||
TERRAFORM_RELEASE=terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS}_${TERRAFORM_ARCH} | ||
TERRAFORM_URL=https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/${TERRAFORM_RELEASE}.zip | ||
|
||
# Extract, then delete temporary file. | ||
( | ||
terraform_zip=$(mktemp -t terraform) | ||
trap "rm -f \"\$terraform_zip\"" EXIT | ||
echo "$terraform_zip" | ||
exit 1 | ||
curl "$TERRAFORM_URL" > "$terraform_zip" | ||
unzip -od /usr/local/bin/ "$terraform_zip" | ||
) | ||
|
||
# Install Ansible. | ||
if test -d /etc/apt; then | ||
echo 'deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main' >> /etc/apt/sources.list | ||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 | ||
apt-get update --allow-releaseinfo-change -y | ||
apt-get install -y ansible rsync curl sudo gnupg2 jq | ||
apt-get clean -y | ||
elif test "$uname_s" == darwin; then | ||
brew update | ||
brew install ansible rsync curl gnupg2 jq | ||
brew cleanup | ||
else | ||
echo "Don't know how to install Ansible, so I'm skipping..." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#! /bin/bash | ||
set -ueo pipefail | ||
|
||
real0=$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}") | ||
thisdir=$(cd "$(dirname -- "$real0")" > /dev/null && pwd -P) | ||
|
||
export NETWORK_NAME=${NETWORK_NAME-localtest} | ||
|
||
mkdir -p "$NETWORK_NAME/setup" | ||
cd "$NETWORK_NAME/setup" | ||
|
||
# Speed up the docker deployment by pre-mounting /usr/src/agoric-sdk. | ||
DOCKER_VOLUMES="$(cd "$thisdir/../../.." > /dev/null && pwd -P):/usr/src/agoric-sdk" \ | ||
"$thisdir/docker-deployment.cjs" > deployment.json | ||
|
||
# Set up the network from our above deployment.json. | ||
"$thisdir/setup.sh" init --noninteractive | ||
|
||
# Go ahead and bootstrap. | ||
exec "$thisdir/setup.sh" bootstrap ${1+"$@"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#! /bin/bash | ||
# setup.sh - Run the local ag-setup-cosmos with arguments | ||
set -ueo pipefail | ||
|
||
real0=$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}") | ||
thisdir=$(cd "$(dirname -- "$real0")" > /dev/null && pwd -P) | ||
|
||
NETWORK_NAME=${NETWORK_NAME-localtest} | ||
export NETWORK_NAME | ||
|
||
export AG_SETUP_COSMOS_NAME=$NETWORK_NAME | ||
export AG_SETUP_COSMOS_HOME="$PWD" | ||
|
||
# Put our bindir into the PATH so that children can find ag-setup-cosmos. | ||
export PATH="$thisdir/../bin:$PATH" | ||
|
||
# Run our setup command. | ||
exec ag-setup-cosmos ${1+"$@"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.