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

enable CI #1

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Proposal tests

# run on all PRs
on:
pull_request:
merge_group:
push:
branches: [master]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test-proposals:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: free up disk space
run: |
# Workaround to provide additional free space for testing.
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
# If this turns out not to be enough, maybe look instead at
# https://github.com/actions/runner-images/issues/2840#issuecomment-1540506686
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "=== After cleanup:"
df -h
- uses: actions/checkout@v3
- name: build proposals test
run: |
docker build \
-t docker-upgrade-test:latest \
-f Dockerfile upgrade-test-scripts
- name: run final proposal
run: docker run --env "DEST=0" docker-upgrade-test:latest
- name: notify on failure
if: failure() && github.event_name != 'pull_request'
uses: ./.github/actions/notify-status
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}
18 changes: 4 additions & 14 deletions upgrade-test/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Defaults
ARG DEST_IMAGE=ghcr.io/agoric/agoric-sdk:dev

# TODO different naming scheme for upgrade handler (in app.go) and the image name

###
Expand All @@ -9,7 +6,7 @@ ARG DEST_IMAGE=ghcr.io/agoric/agoric-sdk:dev
# UPGRADE+TEST legacy layer type in which the chain upgrade and its tests are comingled
# UPGRADE layer that only runs the upgrade handler
# TEST layer that only tests a previous upgrade
# DEST the final layer this build is producing, opening an interactive shell
# FINAL the final layer this build is producing, running the chain

## START
# on agoric-uprade-7-2, with upgrade to agoric-upgrade-8
Expand Down Expand Up @@ -40,7 +37,6 @@ SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh

## UPGRADE+TEST
ARG DEST_IMAGE
#this is agoric-upgrade-8-1 aka pismoB
FROM ghcr.io/agoric/agoric-sdk:30 as agoric-upgrade-8-1
ARG UPGRADE_INFO_9
Expand All @@ -54,7 +50,6 @@ SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh

# UPGRADE+TEST
ARG DEST_IMAGE
# this is agoric-upgrade-9 / pismoC with upgrade to agoric-upgrade-10
FROM ghcr.io/agoric/agoric-sdk:31 as agoric-upgrade-9
ARG UPGRADE_INFO_10
Expand All @@ -70,7 +65,6 @@ SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh

# UPGRADE+TEST
ARG DEST_IMAGE
#this is agoric-upgrade-10 / vaults
FROM ghcr.io/agoric/agoric-sdk:35 as agoric-upgrade-10
ENV THIS_NAME=agoric-upgrade-10 USE_JS=1
Expand All @@ -87,7 +81,6 @@ SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh

# UPGRADE
ARG DEST_IMAGE
#this is agoric-upgrade-10 upgrading to 11
#it's a separate target because agoric-upgrade-10 takes so long to test
FROM ghcr.io/agoric/agoric-sdk:35 as propose-agoric-upgrade-11
Expand All @@ -106,7 +99,6 @@ RUN . ./upgrade-test-scripts/start_to_to.sh

# TEST
#this is agoric-upgrade-11 / vaults+1
ARG DEST_IMAGE
FROM ghcr.io/agoric/agoric-sdk:36 as agoric-upgrade-11
ENV THIS_NAME=agoric-upgrade-11 USE_JS=1
# start-chain boilerplate
Expand All @@ -122,7 +114,6 @@ SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh

# UPGRADE
ARG DEST_IMAGE
FROM ghcr.io/agoric/agoric-sdk:36 as propose-agoric-upgrade-12
# TODO: Replace with actual Zoe core proposal for upgrade 12 (MCS, Kread, Zoe, restart-contracts, etc)
ARG UPGRADE_INFO_12='{"coreProposals":["@agoric/builders/scripts/vats/init-network.js"]}'
Expand All @@ -139,11 +130,10 @@ RUN chmod +x ./upgrade-test-scripts/*.sh
SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh

# DEST (TEST)
# FINAL (TEST)
#this is agoric-upgrade-12 / multi-collateral, etc.
ARG DEST_IMAGE
FROM ${DEST_IMAGE} as agoric-upgrade-12
ENV THIS_NAME=agoric-upgrade-12
FROM ghcr.io/agoric/agoric-sdk:dev as agoric-upgrade-12
ENV THIS_NAME=agoric-upgrade-12 USE_JS=1
COPY --from=propose-agoric-upgrade-12 /root/.agoric /root/.agoric
# start-chain boilerplate
WORKDIR /usr/src/agoric-sdk/
Expand Down
7 changes: 1 addition & 6 deletions upgrade-test/Makefile → Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
REPOSITORY = agoric/upgrade-test
# use :dev (latest prerelease image) unless we build local sdk
DEST_IMAGE ?= $(if $(findstring local_sdk,$(MAKECMDGOALS)),ghcr.io/agoric/agoric-sdk:latest,ghcr.io/agoric/agoric-sdk:dev)
TARGET?=agoric-upgrade-12
dockerLabel?=$(TARGET)
@echo target: $(TARGET)

local_sdk:
(cd ../ && make docker-build-sdk)

BUILD = docker build --progress=plain $(BUILD_OPTS) \
--build-arg DEST_IMAGE=$(DEST_IMAGE) \
-f Dockerfile upgrade-test-scripts

agoric-upgrade-7-2:
Expand Down Expand Up @@ -62,4 +57,4 @@ run_bash:
shell:
docker exec -it `docker ps --latest --format json | jq -r .Names` bash

.PHONY: local_sdk agoric-upgrade-7-2 agoric-upgrade-8 agoric-upgrade-8-1 agoric-upgrade-9 agoric-upgrade-10 agoric-upgrade-11 agoric-upgrade-12 build build_test run
.PHONY: agoric-upgrade-7-2 agoric-upgrade-8 agoric-upgrade-8-1 agoric-upgrade-9 agoric-upgrade-10 agoric-upgrade-11 agoric-upgrade-12 build build_test run
125 changes: 124 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,125 @@
# mainnet-proposals
# agoric-3-proposals

Proposals run or planned for Mainnet (agoric-3)

This will build all previous upgrade proposals and upgrade each one.

## Upgrades

| number | description | notes |
| ------ | -------------- | -------------------------------------------------------------------------- |
| 8 | PismoA | Runs with Pismo release agoric-sdk (including CLI) |
| 8.1 | PismoB |
| 9 | PismoC |
| 10 | --> Vaults | Runs with latest SDK. Tests backwards compatibility with Pismo vstorage. |
| 11 | Vaults --> V+1 | Anticipated upgrade. Tests that Vaults release _can be_ upgraded in place. |

## Testing

**To build the images to latest**

```shell
make build
```

Each stage specifies the SDK version in service when it was deployed.

The last stage hasn't been deployed so it uses the lastest image tagged `dev` in our [container repository](https://github.com/agoric/agoric-sdk/pkgs/container/agoric-sdk).

This repo doesn't yet support specifying an SDK version to test against.

**To run the latest upgrade interactively**

```shell
make run
```

This will start a container with the output of chain start.

To get a shell: `make shell`

For more info: https://phase2.github.io/devtools/common-tasks/ssh-into-a-container/

The container and chain will halt once you detach from the session.

### Troubleshooting
If you get an error about port 26656 already in use, you have a local chain running on your OS.

**To build and run a specific upgrade**

```shell
TARGET=agoric-upgrade-10 make build run
```

This will put you in `/usr/src/agoric-sdk`. You'll run commands from here. `upgrade-test-scripts` is copied here with only the test scripts for the current image.


If you lose the connection and want to get back,
```sh
# find the container id
docker ps
# reattach using the auto-generated goofy name
docker attach sweet_edison
```

**To pass specific `software-upgrade --upgrade-info`**

```shell
json='{"some":"json","here":123}'
make build BUILD_OPTS="--build-arg UPGRADE_INFO_11='$json'"
```

Search this directory for `UPGRADE_INFO` if you want to see how it is plumbed
through.

**To test CLI**

You can point your local CLI tools to the chain running in Docker. Our Docker config binds on the same port (26656) as running a local chain. So you can use the agoric-cli commands on the Docker chain the same way. But note that the Cosmos account keys will be different from in your dev keyring.

If when reattaching you get a log tail, you need to start a new TTY (with the container name).
```sh
docker exec -it sweet_edison bash
```

or just use this helper,
```
make shell
```


**To test GUI**

To make the wallet ui talk to your local chain, set the network config to
`https://local.agoric.net/network-config`

## To add an upgrade

1. Update the upgrade handler in app.go
2. Duplicate the last pair of UPGRADE and TEST blocks
3. Update their number from the UPGRADE / DEST block at the end
4. Make directory for tests (e.g. `agoric-upgrade-12`)
4. Make directory for ugprade (e.g. `propose-agoric-upgrade-12` with a `.keep`)
5. Update the UPGRADE/DEST pair to be your new upgrade (THIS_NAME matching the upgrade handler string in app.go)
6. Update the `Makefile`
- the two targets to `Makefile` (e.g. `propose-agoric-upgrade-12` and `agoric-upgrade-12`)
- set the default TARGET (e.g. `agoric-upgrade-12`)
- add the DEST target to the `.phony` in `Makefile`
7. Test with `make build run`


## Development

You can iterate on a particular upgrade by targeting. When you exit and run again, it will be a fresh state.

You can send information from one run to the next using `/envs`. A release N can append ENV variable setting shell commands to `"$HOME/.agoric/envs"`. The N+1 release will then have them in its environment. (Because `env_setup.sh` starts with `source "$HOME/.agoric/envs"`)

### IDE

Some IDEs support connecting to a running container. For VS Code you can use [Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers) to connect to a run above. Then you can edit the filesystem using the IDE. Once the workspace opens, you have to add a folder. E.g. `/usr/src/agoric-sdk/packages/agoric-cli/` for tweaking agoric-cli (without a rebuild of SDK).
Note that whatever changes you make within the running container will be lost when you terminate it. Use this just for iterating and be sure to copy any changes you want back to your real workspace.

# TODO
- [X] make the Docker test environment log verbosely (agd start is just printing "block N" begin, commit)
- [ ] alternately, mount the local agoric-sdk in the container
- [ ] provide a utility to import the Docker's GOV123 keys into a local keyring

Loading