Skip to content

debug

debug #124

Workflow file for this run

name: Google Artifact Registry
on:
push:
branches:
- main
- dev
- dockercomposeaction
tags:
- "*"
jobs:
docker-release:
name: Tagged Docker release to Google Artifact Registry
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
steps:
# 1. Checkout the Repository
- id: checkout
name: Checkout
uses: actions/checkout@v4
# 2. Authenticate with Google Cloud
- id: auth
name: Authenticate with Google Cloud
uses: google-github-actions/auth@v2
with:
token_format: access_token
credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }}
access_token_lifetime: 1800s
# 3. Configure Docker to Use Google Artifact Registry
- name: Configure container registry
run: gcloud auth configure-docker us-east1-docker.pkg.dev
# 4. Set Up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 5. Login to Artifact Registry
- name: Login to Artifact Registry
uses: docker/login-action@v3
with:
registry: us-east1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
# 6. Determine Docker Tag Based on Git Reference
- name: Get tag
id: get-tag
run: echo "short_ref=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Set Docker Tag
id: tag
run: |
if [[ "${GITHUB_REF}" == refs/heads/main ]]; then
tag="latest"
elif [[ "${GITHUB_REF}" == refs/heads/dev ]]; then
tag="nightly"
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
tag=${GITHUB_REF#refs/tags/}
else
tag=${GITHUB_REF#refs/heads/}
fi
echo "tag=${tag}" >> $GITHUB_OUTPUT
echo "Docker tag: ${tag}"
# 7. Build Docker Image (Load Locally Only)
- name: Build Docker Image
uses: docker/build-push-action@v6
with:
push: false # Do not push in this step
load: true # Load the image into Docker cache
tags: |
wvm:local
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wvm:${{ steps.get-tag.outputs.short_ref }}
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wvm:${{ steps.tag.outputs.tag }}
cache-from: type=registry,ref=us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wvm:${{ steps.tag.outputs.tag }}
cache-to: type=registry,ref=us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wvm:${{ steps.tag.outputs.tag }},mode=max
# 8. Test Docker Image Using Local Tag
- name: Test Docker
run: |-
mkdir -m 777 .testnet
cd .testnet
git clone https://github.com/weaveVM/wvm-docker-testnet.git .
echo ${{ secrets.GCP_CREDENTIALS_JSON }} > ./execution/key.json
./clean.sh
docker compose up -d || {
echo "Docker Compose failed. Collecting logs...";
docker ps -a; # Show status of all containers
docker compose logs > compose_logs.txt;
docker logs testnet-reth-genesis-1 > reth-genesis.log 2>&1 || echo "No logs for testnet-reth-genesis-1";
docker logs testnet-create-beacon-chain-genesis-1 > beacon-genesis.log 2>&1 || echo "No logs for testnet-create-beacon-chain-genesis-1";
echo "Logs for reth-genesis:";
cat reth-genesis.log;
echo "Logs for beacon-genesis:";
cat beacon-genesis.log;
echo "All Docker Compose logs:";
cat compose_logs.txt;
exit 1;
}
npm install
SIGNER_KEY=${{ secrets.TEST_SIGNER_KEY }} node test.js
docker compose down
cd .. && sudo rm -rf .testnet
# 9. Push Verified Docker Images to Artifact Registry
- name: Push to Artifact Registry
uses: docker/build-push-action@v6
with:
push: true # Enable pushing
tags: |
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wvm:${{ steps.get-tag.outputs.short_ref }}
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wvm:${{ steps.tag.outputs.tag }}
cache-from: type=registry,ref=us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wvm:${{ steps.tag.outputs.tag }}
cache-to: type=registry,ref=us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wvm:${{ steps.tag.outputs.tag }},mode=max
# 10. Clean Up Local Docker Tags (Optional)
- name: Remove Local Tag
if: always() # Run regardless of previous step outcomes
run: docker rmi wvm:local || true