Skip to content

Commit

Permalink
Merge branch 'master' into testnet-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
h0ngcha0 committed Oct 16, 2023
2 parents 817bf2d + a5482e7 commit f071d17
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 49 deletions.
21 changes: 1 addition & 20 deletions .github/workflows/it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
node-version: '16'
- name: build devnet docker images
run: ./build-docker-images.sh "devnet"
run: ./build-docker-images.sh "devnet" "latest"
- name: docker system prune
run: docker system prune -f
- name: start docker images
Expand All @@ -44,22 +44,3 @@ jobs:
if: success() || failure()
uses: jwalton/[email protected]
# Next publish docker images after integration tests pass
publish:
needs: test
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: projects/1004240933630/locations/global/workloadIdentityPools/github-pool/providers/github-provider
service_account: [email protected]
- name: auth docker
run: gcloud auth configure-docker
- name: build and push testnet docker images
run: ./build-docker-images.sh "testnet" true
47 changes: 47 additions & 0 deletions .github/workflows/publish-docker-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Docker Images

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
workflow_dispatch:

jobs:
get_dist_tag:
runs-on: ubuntu-latest
outputs:
DIST_TAG: ${{ steps.get_tag.outputs.DIST_TAG }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Get the tag name
id: get_tag
run: |
tag=$(echo ${GITHUB_REF/refs\/tags\//} | cut -c 2-)
dist_tag=$([[ $tag =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo latest || echo "")
dist_tag=$([[ $tag =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$ ]] && echo rc || echo $dist_tag)
[ -z "$dist_tag" ] && echo "Distribution tag is not set to latest nor to rc" && exit 1
echo ::set-output name=DIST_TAG::$dist_tag
shell: bash
publish:
runs-on: ubuntu-20.04
needs: get_dist_tag
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: projects/1004240933630/locations/global/workloadIdentityPools/github-pool/providers/github-provider
service_account: [email protected]
- name: auth docker
run: gcloud auth configure-docker
- name: build and push testnet docker images
run: ./build-docker-images.sh "testnet" ${{ needs.get_dist_tag.outputs.DIST_TAG }} true
28 changes: 14 additions & 14 deletions build-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
NETWORKS=('mainnet' 'testnet' 'devnet')

network=$1

pushImage=${2:-false}
version=$2
pushImage=${3:-false}

if [ -z "${network// }" ]
then
Expand All @@ -14,7 +14,7 @@ fi

set -euo pipefail xtrace

VERSION=0.2.121
echo pushImage: $pushImage

export DOCKER_BUILDKIT=1

Expand All @@ -26,7 +26,7 @@ else
exit 1
fi

docker build -f ./docker/Dockerfile.init . -t eu.gcr.io/alephium-org/devnet-init:$VERSION
docker build -f ./docker/Dockerfile.init . -t eu.gcr.io/alephium-org/devnet-init:$version

# Build proto-gen, generate node/pkg/proto dir
docker build --target go-export -f ./docker/Dockerfile.proto -o type=local,dest=node .
Expand All @@ -35,29 +35,29 @@ docker build --target go-export -f ./docker/Dockerfile.proto -o type=local,dest=
docker build --target node-export -f ./docker/Dockerfile.proto -o type=local,dest=. .

# Build guardian image (used for both guardian & spy)
docker build -f ./node/Dockerfile . -t eu.gcr.io/alephium-org/guardiand:$VERSION --build-arg network=$network
docker build -f ./node/Dockerfile . -t eu.gcr.io/alephium-org/guardiand:$version --build-arg network=$network

## Build eth-node image
docker build -f ./ethereum/Dockerfile . -t eu.gcr.io/alephium-org/eth-node:$VERSION
docker build -f ./ethereum/Dockerfile . -t eu.gcr.io/alephium-org/eth-node:$version

docker build -f ./alephium/Dockerfile . -t eu.gcr.io/alephium-org/alephium-contracts:$VERSION
docker build -f ./alephium/Dockerfile . -t eu.gcr.io/alephium-org/alephium-contracts:$version

## Build Bridge UI
docker build -f ./bridge_ui/Dockerfile . -t eu.gcr.io/alephium-org/bridge-ui-$network:$VERSION --build-arg network=$network
docker build -f ./bridge_ui/Dockerfile . -t eu.gcr.io/alephium-org/bridge-ui-$network:$version --build-arg network=$network

## Build Explorer Images
### explorer-api-server
docker build -f ./explorer-api-server/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer-api-server:$VERSION
docker build -f ./explorer-api-server/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer-api-server:$version

### explorer-backend
docker build -f ./explorer-backend/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer-backend:$VERSION
docker build -f ./explorer-backend/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer-backend:$version

### explorer
docker build -f ./explorer/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer:$VERSION
docker build -f ./explorer/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer:$version

if [ "${pushImage}" = true ]
then
docker push eu.gcr.io/alephium-org/guardiand:$VERSION
docker push eu.gcr.io/alephium-org/bridge-ui-$network:$VERSION
docker push eu.gcr.io/alephium-org/wormhole-explorer:$VERSION
docker push eu.gcr.io/alephium-org/guardiand:$version
docker push eu.gcr.io/alephium-org/bridge-ui-$network:$version
docker push eu.gcr.io/alephium-org/wormhole-explorer:$version
fi
2 changes: 1 addition & 1 deletion devnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Build the docker images:
```sh
git clone [email protected]:alephium/wormhole-fork.git
cd wormhole-fork/
./build-docker-images.sh devnet
./build-docker-images.sh devnet latest
```

Start the devnet:
Expand Down
28 changes: 14 additions & 14 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
timeout: 45s

alph-deploy-contracts:
image: eu.gcr.io/alephium-org/alephium-contracts:0.2.121
image: eu.gcr.io/alephium-org/alephium-contracts:latest
environment:
NODE_URL: http://alephium:22973
depends_on:
Expand Down Expand Up @@ -83,7 +83,7 @@ services:
- EXPLORER_READONLY=false

eth-devnet:
image: eu.gcr.io/alephium-org/eth-node:0.2.121
image: eu.gcr.io/alephium-org/eth-node:latest
restart: unless-stopped
user: root
ports:
Expand All @@ -101,14 +101,14 @@ services:
- --chainId=1338

eth-devnet-deploy-contracts:
image: eu.gcr.io/alephium-org/eth-node:0.2.121
image: eu.gcr.io/alephium-org/eth-node:latest
command:
- /bin/sh
- -c
- "cd .. && git apply ./ethereum/1conf.patch && cd ethereum && CHAIN_NAME=ethereum npm run migrate -- --network ethDocker && npx truffle exec mine.js --network ethDocker"

bsc-devnet:
image: eu.gcr.io/alephium-org/eth-node:0.2.121
image: eu.gcr.io/alephium-org/eth-node:latest
restart: unless-stopped
user: root
ports:
Expand All @@ -126,14 +126,14 @@ services:
- --chainId=1397

bsc-devnet-deploy-contracts:
image: eu.gcr.io/alephium-org/eth-node:0.2.121
image: eu.gcr.io/alephium-org/eth-node:latest
command:
- /bin/sh
- -c
- "cd .. && git apply ./ethereum/1conf.patch && cd ethereum && CHAIN_NAME=bsc npm run migrate -- --network bscDocker && npx truffle exec mine.js --network bscDocker"

devnet-init:
image: eu.gcr.io/alephium-org/devnet-init:0.2.121
image: eu.gcr.io/alephium-org/devnet-init:latest
environment:
- NUM_OF_GUARDIANS=${NUM_OF_GUARDIANS:-1}
command:
Expand All @@ -142,7 +142,7 @@ services:
- "/scripts/devnet-init.sh"

guardian-0:
image: eu.gcr.io/alephium-org/guardiand:0.2.121
image: eu.gcr.io/alephium-org/guardiand:latest
hostname: guardian-0
restart: unless-stopped
ports:
Expand Down Expand Up @@ -181,7 +181,7 @@ services:
- --logLevel=debug

guardian-1:
image: eu.gcr.io/alephium-org/guardiand:0.2.121
image: eu.gcr.io/alephium-org/guardiand:latest
hostname: guardian-1
restart: unless-stopped
ports:
Expand Down Expand Up @@ -222,7 +222,7 @@ services:
- --logLevel=debug

guardian-2:
image: eu.gcr.io/alephium-org/guardiand:0.2.121
image: eu.gcr.io/alephium-org/guardiand:latest
hostname: guardian-2
restart: unless-stopped
ports:
Expand Down Expand Up @@ -263,7 +263,7 @@ services:
- --logLevel=debug

spy:
image: eu.gcr.io/alephium-org/guardiand:0.2.121
image: eu.gcr.io/alephium-org/guardiand:latest
restart: unless-stopped
ports:
- 127.0.0.1:7072:7072
Expand Down Expand Up @@ -317,7 +317,7 @@ services:
ME_CONFIG_MONGODB_URL: ${ME_CONFIG_MONGODB_URL:-mongodb://mongo:27017/?directConnection=true}

wormhole-explorer-backend:
image: eu.gcr.io/alephium-org/wormhole-explorer-backend:0.2.121
image: eu.gcr.io/alephium-org/wormhole-explorer-backend:latest
restart: unless-stopped
ports:
- 127.0.0.1:8101:8101
Expand Down Expand Up @@ -353,7 +353,7 @@ services:
- ws://eth-devnet:8545

wormhole-explorer-api-server:
image: eu.gcr.io/alephium-org/wormhole-explorer-api-server:0.2.121
image: eu.gcr.io/alephium-org/wormhole-explorer-api-server:latest
restart: unless-stopped
ports:
- 127.0.0.1:8100:8100
Expand All @@ -373,13 +373,13 @@ services:
- --enableStackTrace=true

bridge-ui:
image: eu.gcr.io/alephium-org/bridge-ui-devnet:0.2.121
image: eu.gcr.io/alephium-org/bridge-ui-devnet:latest
restart: unless-stopped
ports:
- 127.0.0.1:30001:3000

wormhole-exporer:
image: eu.gcr.io/alephium-org/wormhole-explorer:0.2.121
image: eu.gcr.io/alephium-org/wormhole-explorer:latest
restart: unless-stopped
ports:
- 127.0.0.1:30002:8000
Expand Down

0 comments on commit f071d17

Please sign in to comment.