-
Notifications
You must be signed in to change notification settings - Fork 226
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
ci: schedule a Docker deployment test #4133
Changes from all commits
e866975
3b9e8b1
0de794d
7c23b16
5c88f95
ed7177b
e3ce528
d75868b
9c8c09a
d587990
1791164
aa551d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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' |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../src/entrypoint.js |
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`); |
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 |
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]}") | ||
mhofman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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+"$@"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason to exec here? Should the test be nice and cleanly stop the bootstrapped chain? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those are reasonable improvements, but not necessary for the Github Actions test, so I didn't do them. |
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+"$@"} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,9 +278,12 @@ const doInit = ({ | |
}) => async (progname, args) => { | ||
const { needDoRun, cwd, chdir } = running; | ||
const PROVIDERS = makeProviders({ env, inquirer, wr, setup, fetch }); | ||
let { | ||
_: [dir, overrideNetworkName], | ||
} = parseArgs(args.slice(1)); | ||
|
||
const { _: parsedArgs, noninteractive } = parseArgs(args.slice(1), { | ||
boolean: ['noninteractive'], | ||
}); | ||
let [dir, overrideNetworkName] = parsedArgs; | ||
|
||
if (!dir) { | ||
dir = setup.SETUP_HOME; | ||
} | ||
|
@@ -323,8 +326,7 @@ const doInit = ({ | |
}); | ||
config.NETWORK_NAME = overrideNetworkName; | ||
|
||
// eslint-disable-next-line no-constant-condition | ||
while (true) { | ||
while (!noninteractive) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I presume this halts! |
||
// eslint-disable-next-line no-await-in-loop | ||
const { ROLE, ...rest } = await askPlacement({ inquirer })( | ||
config.PLACEMENTS, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍