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

ci: schedule a Docker deployment test #4133

Merged
merged 12 commits into from
Nov 30, 2021
Merged

Conversation

michaelfig
Copy link
Member

@michaelfig michaelfig commented Nov 29, 2021

refs: #3444

Description

Have CI bootstrap a network with the packages/deployment machinery. This should help detect both obvious multinode nondeterminisms as well as test out our deployment tooling.

Security Considerations

Documentation Considerations

Testing Considerations

This PR produces the current known-failure at https://github.com/Agoric/agoric-sdk/runs/4361816825#step:7:2272

@michaelfig michaelfig added the deployment Chain deployment mechanism (e.g. testnet) label Nov 29, 2021
@michaelfig michaelfig self-assigned this Nov 29, 2021
@michaelfig michaelfig force-pushed the mfig-docker-deployment-test branch 12 times, most recently from a5071a3 to 2475cca Compare November 30, 2021 02:33
@michaelfig michaelfig changed the title ci: run a simple Docker deployment test ci: schedule a Docker deployment test Nov 30, 2021
@michaelfig michaelfig marked this pull request as ready for review November 30, 2021 02:36
Copy link
Contributor

@JimLarson JimLarson left a comment

Choose a reason for hiding this comment

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

The shell stuff looks okay. The yaml doesn't set off alarms. You might want another pair of eyes on the JS.

esac

TERRAFORM_RELEASE=terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS}_${TERRAFORM_ARCH}
curl https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/${TERRAFORM_RELEASE}.zip > terraform.zip && \
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure of the context in which this script is run, but double-check that it's okay to create potentially large files in whatever the current directory is. unzip can't extract from stdin? Lame!

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to use a temporary file with mktemp.

Copy link
Member

@kriskowal kriskowal left a comment

Choose a reason for hiding this comment

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

Glossed for bash style. I highly recommend shellcheck.

@@ -0,0 +1,59 @@
#! /bin/bash
# Get a deployment.json for a 2-node docker setup.
set -e
Copy link
Member

Choose a reason for hiding this comment

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

Recommending set -ueo pipefail as the standard utterance.

"PROVIDER_NEXT_INDEX": {
"docker": 1
},
"NETWORK_NAME": "$NETWORK_NAME"
Copy link
Member

Choose a reason for hiding this comment

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

I distrust interpolation here on principle. If there's any chance you can rely on jq, I like the pattern of jq --arg NETWORK_NAME "$NETWORK_NAME" -n <<EOF. If you can rely on node instead...

Copy link
Member Author

Choose a reason for hiding this comment

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

Duly Noded.

esac

TERRAFORM_RELEASE=terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS}_${TERRAFORM_ARCH}
curl https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/${TERRAFORM_RELEASE}.zip > terraform.zip && \
Copy link
Member

Choose a reason for hiding this comment

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

shellcheck would tell you to quote this so that it means the same thing if a field separator snuck into one of the variables.

Copy link
Member Author

Choose a reason for hiding this comment

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

I installed the Shellcheck VSCode plugin. Very nice!

# Install Ansible.
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 && \
Copy link
Member

Choose a reason for hiding this comment

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

The \ is superfluous since the line ends with an operator.

Copy link
Member

@kriskowal kriskowal left a comment

Choose a reason for hiding this comment

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

The JavaScript looks good to me.

// explanation.
// eslint-disable-next-line @endo/no-polymorphic-call
- console.log(`Removing ${subPath}`);
+ console.warn(`Removing ${subPath}`);
Copy link
Member

Choose a reason for hiding this comment

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

I see this. I should prioritize fixing this generally.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I'm not sure we should patch this out

Copy link
Member Author

Choose a reason for hiding this comment

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

The patch is an expedient to prevent actual failures when stdout is captured. When we upgrade SES and it fails to apply, we'll get a warning.

Copy link
Member

@mhofman mhofman Nov 30, 2021

Choose a reason for hiding this comment

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

Would it fail to apply tho? The fix will not touch these console statements.

Why would stdout cause failures?

Copy link
Member Author

Choose a reason for hiding this comment

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

Would it fail to apply tho? The fix will not touch these console statements.

patch-packages tracks the version number of the package you're patching. It will warn when the version doesn't match the one named by the patches/*+VERSION.patch file.

Why would stdout cause failures?

./my-ses-program-running-on-node16 > ./critical-file.txt

Oops, now your critical-file.txt starts with:

Removing intrinsics.Object.hasOwn

Copy link
Member

Choose a reason for hiding this comment

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

oh you're right, these should go to stderr instead of stdout! For some reason I misread the patch, sorry.
@kriskowal Any reason these are console.log instead of console.warn in the first place?

@@ -323,8 +326,7 @@ const doInit = ({
});
config.NETWORK_NAME = overrideNetworkName;

// eslint-disable-next-line no-constant-condition
while (true) {
while (!noninteractive) {
Copy link
Member

Choose a reason for hiding this comment

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

I presume this halts!

@@ -34,7 +34,7 @@ jobs:
# 'yarn install' must be done at the top level, to build all the
# cross-package symlinks
- name: yarn install
run: yarn install
run: yarn install --frozen-lockfile
Copy link
Member

Choose a reason for hiding this comment

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

👍

// explanation.
// eslint-disable-next-line @endo/no-polymorphic-call
- console.log(`Removing ${subPath}`);
+ console.warn(`Removing ${subPath}`);
Copy link
Member

Choose a reason for hiding this comment

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

Yeah I'm not sure we should patch this out

@michaelfig michaelfig force-pushed the mfig-docker-deployment-test branch from 2475cca to aa551d6 Compare November 30, 2021 04:12
@michaelfig michaelfig added the automerge:no-update (expert!) Automatically merge without updates label Nov 30, 2021
@mergify mergify bot merged commit ad91d2b into master Nov 30, 2021
@mergify mergify bot deleted the mfig-docker-deployment-test branch November 30, 2021 04:25
"$thisdir/setup.sh" init --noninteractive

# Go ahead and bootstrap.
exec "$thisdir/setup.sh" bootstrap ${1+"$@"}
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:no-update (expert!) Automatically merge without updates deployment Chain deployment mechanism (e.g. testnet)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants