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

refactor: clarify upgrade builds #8259

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ jobs:
cd packages/deployment/upgrade-test && \
docker build \
--build-arg BOOTSTRAP_MODE=${{ matrix.bootstrap-version }} \
--build-arg DEST_IMAGE=ghcr.io/agoric/agoric-sdk:latest \
--build-arg SDK_IMAGE=ghcr.io/agoric/agoric-sdk:latest \
-t docker-upgrade-test:latest -f Dockerfile upgrade-test-scripts
- name: docker run upgrade final stage
run: docker run --env "DEST=0" docker-upgrade-test:latest
Expand Down
84 changes: 54 additions & 30 deletions packages/deployment/upgrade-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
ARG DEST_IMAGE=ghcr.io/agoric/agoric-sdk:dev
# Defaults
ARG SDK_IMAGE=ghcr.io/agoric/agoric-sdk:dev
ARG BOOTSTRAP_MODE=main

## FIRST LAYER
# on agoric-uprade-7-2, with upgrade to agoric-upgrade-8
FROM ghcr.io/agoric/ag0:agoric-upgrade-7-2 as agoric-upgrade-7-2
ARG BOOTSTRAP_MODE
Expand All @@ -11,94 +14,115 @@ WORKDIR /usr/src/agoric-sdk/
COPY ./start_ag0.sh ./upgrade-test-scripts/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./upgrade-test-scripts/
SHELL ["/bin/bash", "-c"]
# this is the only layer that starts ag0
RUN . ./upgrade-test-scripts/start_ag0.sh

## UPGRADE LAYER
## this is agoric-upgrade-8 aka pismoA
FROM ghcr.io/agoric/agoric-sdk:29 as agoric-upgrade-8
ARG BOOTSTRAP_MODE
# ??? why doesn't this set UPGRADE_TO ?
Copy link
Member

Choose a reason for hiding this comment

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

The upgrade from pismoA to pismoB was a hot fix (without a governance proposal), so it doesn't use any tx gov software-update.

ENV THIS_NAME=agoric-upgrade-8 BOOTSTRAP_MODE=${BOOTSTRAP_MODE}
WORKDIR /usr/src/agoric-sdk/
# copy from previous build
COPY --from=agoric-upgrade-7-2 /root/.agoric /root/.agoric

COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./upgrade-test-scripts/
#region boilerplate to copy scripts for this upgrade
# This does more than it needs to in some steps, to simplify maintenance in its repeated use
WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./package.json ./*.mjs ./upgrade-test-scripts/
COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
COPY --from=agoric-upgrade-7-2 /root/.agoric /root/.agoric
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK, this very much needs to be copied as it's the state of ag0/agd

Copy link
Member

Choose a reason for hiding this comment

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

this very much needs to be copied
It is copied on green line 28 (just a moved line, not a deletion), but this threw me for a loop as well.

It looks like @turadg was trying to reorder each of these sections so that they matched one another.

RUN chmod +x ./upgrade-test-scripts/*.sh
SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh
#endregion

ARG DEST_IMAGE
## UPGRADE LAYER
#this is agoric-upgrade-8-1 aka pismoB
FROM ghcr.io/agoric/agoric-sdk:30 as agoric-upgrade-8-1
# Each upgrade layer has this argument to let developers specify an UPGRADE_INFO JSON for each layer
ARG BOOTSTRAP_MODE UPGRADE_INFO_9
ENV THIS_NAME=agoric-upgrade-8-1 UPGRADE_TO=agoric-upgrade-9 UPGRADE_INFO=${UPGRADE_INFO_9} BOOTSTRAP_MODE=${BOOTSTRAP_MODE}

COPY --from=agoric-upgrade-8 /root/.agoric /root/.agoric
#region boilerplate to copy scripts for this upgrade
# This does more than it needs to in some steps, to simplify maintenance in its repeated use
WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./upgrade-test-scripts/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./package.json ./*.mjs ./upgrade-test-scripts/
COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
COPY --from=agoric-upgrade-8 /root/.agoric /root/.agoric
RUN chmod +x ./upgrade-test-scripts/*.sh
SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh
#endregion

ARG DEST_IMAGE
## UPGRADE LAYER
# this is agoric-upgrade-9 / pismoC with upgrade to agoric-upgrade-10
FROM ghcr.io/agoric/agoric-sdk:31 as agoric-upgrade-9
ARG BOOTSTRAP_MODE UPGRADE_INFO_10
ENV THIS_NAME=agoric-upgrade-9 UPGRADE_TO=agoric-upgrade-10 UPGRADE_INFO=${UPGRADE_INFO_10} BOOTSTRAP_MODE=${BOOTSTRAP_MODE}

WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./upgrade-test-scripts/
COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
COPY --from=agoric-upgrade-8-1 /root/.agoric /root/.agoric
#region boilerplate to copy scripts for this upgrade
# This does more than it needs to in some steps, to simplify maintenance in its repeated use
WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./package.json ./*.mjs ./upgrade-test-scripts/
COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
RUN chmod +x ./upgrade-test-scripts/*.sh
SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh
#endregion


ARG DEST_IMAGE
## UPGRADE LAYER
#this is agoric-upgrade-10 / vaults
FROM ghcr.io/agoric/agoric-sdk:35 as agoric-upgrade-10
ARG BOOTSTRAP_MODE
ENV THIS_NAME=agoric-upgrade-10 USE_JS=1 BOOTSTRAP_MODE=${BOOTSTRAP_MODE}

COPY --from=agoric-upgrade-9 /root/.agoric /root/.agoric
#region boilerplate to copy scripts for this upgrade
# This does more than it needs to in some steps, to simplify maintenance in its repeated use
WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./package.json ./*.mjs ./upgrade-test-scripts/
COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
COPY --from=agoric-upgrade-9 /root/.agoric /root/.agoric
RUN chmod +x ./upgrade-test-scripts/*.sh
SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh
#endregion

ARG DEST_IMAGE
## UPGRADE LAYER
#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 agoric-upgrade-10-to-11
# This default UPGRADE_INFO_11 is to test core proposals like the network vat.
# TODO: Maybe replace with a Zoe core proposal, or remove when other paths test it.
ARG BOOTSTRAP_MODE UPGRADE_INFO_11='{"coreProposals":["@agoric/builders/scripts/vats/init-network.js"]}'
ENV THIS_NAME=agoric-upgrade-10-to-11 UPGRADE_TO=agoric-upgrade-11 UPGRADE_INFO=${UPGRADE_INFO_11} BOOTSTRAP_MODE=${BOOTSTRAP_MODE}

COPY --from=agoric-upgrade-10 /root/.agoric /root/.agoric
#region boilerplate to copy scripts for this upgrade
# This does more than it needs to in some steps, to simplify maintenance in its repeated use
WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./upgrade-test-scripts/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./package.json ./*.mjs ./upgrade-test-scripts/
COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
COPY --from=agoric-upgrade-10 /root/.agoric /root/.agoric
RUN chmod +x ./upgrade-test-scripts/*.sh
SHELL ["/bin/bash", "-c"]
RUN . ./upgrade-test-scripts/start_to_to.sh
#endregion

ARG DEST_IMAGE
#this is agoric-upgrade-11 / vaults+1
FROM ${DEST_IMAGE} as agoric-upgrade-11
# DEVELOPMENT LAYER
# allow specifying a different SDK image
ARG SDK_IMAGE
#this is agoric-upgrade-11 / vstorage updates
FROM ${SDK_IMAGE} as agoric-upgrade-11
ARG BOOTSTRAP_MODE
ENV THIS_NAME=agoric-upgrade-11 BOOTSTRAP_MODE=${BOOTSTRAP_MODE}
# this boot doesn't need an upgrade

COPY --from=agoric-upgrade-10-to-11 /root/.agoric /root/.agoric
#region boilerplate to copy scripts for this upgrade
# This does more than it needs to in some steps, to simplify maintenance in its repeated use
WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./upgrade-test-scripts/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./package.json ./*.mjs ./upgrade-test-scripts/
COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
COPY --from=agoric-upgrade-10-to-11 /root/.agoric /root/.agoric
RUN apt install -y tmux
SHELL ["/bin/bash", "-c"]
RUN chmod +x ./upgrade-test-scripts/*.sh
SHELL ["/bin/bash", "-c"]
# this boot doesn't need an upgrade
#endregion
# RUN . ./upgrade-test-scripts/start_to_to.sh
# provide tmux for use with TMUX_CC=1
RUN apt install -y tmux
# interactive shell for this whole Dockerfile
ENTRYPOINT /usr/src/agoric-sdk/upgrade-test-scripts/start_to_to.sh
4 changes: 2 additions & 2 deletions packages/deployment/upgrade-test/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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)
SDK_IMAGE ?= $(if $(findstring local_sdk,$(MAKECMDGOALS)),ghcr.io/agoric/agoric-sdk:latest,ghcr.io/agoric/agoric-sdk:dev)
BOOTSTRAP_MODE?=main
ifeq ($(BOOTSTRAP_MODE),main)
TAG_SUFFIX=
Expand All @@ -20,7 +20,7 @@ local_sdk:
(cd ../ && make docker-build-sdk)

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

agoric-upgrade-7-2:
Expand Down
4 changes: 2 additions & 2 deletions packages/deployment/upgrade-test/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ By default pre-releases use the lastest image tagged `dev` in our [container rep
a specific build:

```shell
DEST_IMAGE=docker pull ghcr.io/agoric/agoric-sdk:20230515033839-e56ae7
SDK_IMAGE=docker pull ghcr.io/agoric/agoric-sdk:20230515033839-e56ae7
```
To use a build based on local changes:
```shell
# build ghcr.io/agoric/agoric-sdk:latest
make local_sdk build
# or DEST_IMAGE=ghcr.io/agoric/agoric-sdk:latest make build
# or SDK_IMAGE=ghcr.io/agoric/agoric-sdk:latest make build
```

**To run the latest upgrade interactively**
Expand Down
Loading