Skip to content

Commit 956dd0f

Browse files
authored
Fix pcr0 extraction in docker compose script and correctly shutdown op-proposer-tee (#246)
* fix pcr0 extraction * stopping op-proposer-tee in script * revert to old pcr0 extraction as the new pattern breaks the old pattern * try to fix pcr0 extraction * upload op-proposer-tee
1 parent 611871a commit 956dd0f

File tree

3 files changed

+77
-2
lines changed

3 files changed

+77
-2
lines changed

.github/workflows/docker-images.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,65 @@ jobs:
403403
TARGET_BASE_IMAGE=alpine:3.22
404404
TARGETOS=linux
405405
TARGETARCH=amd64
406+
407+
build-op-proposer-tee:
408+
needs: prepare-deployment
409+
runs-on: ubuntu-latest
410+
permissions:
411+
contents: read
412+
packages: write
413+
steps:
414+
- name: Checkout
415+
uses: actions/checkout@v4
416+
417+
- name: Download deployment artifacts
418+
uses: actions/download-artifact@v4
419+
with:
420+
name: deployment-artifacts
421+
422+
- name: Verify deployment files are present
423+
run: |
424+
echo "=== Verifying downloaded files ==="
425+
ls -la espresso/deployment/ || echo "No deployment directory"
426+
ls -la espresso/deployment/deployer/ || echo "No deployer directory"
427+
ls -la packages/contracts-bedrock/ || echo "No contracts-bedrock directory"
428+
429+
- name: Copy config for op-proposer
430+
run: |
431+
mkdir -p packages/contracts-bedrock/lib/superchain-registry/ops/testdata/monorepo
432+
echo "Config prepared for op-proposer"
433+
434+
- name: Login to GitHub Container Registry
435+
uses: docker/login-action@v3
436+
with:
437+
registry: ${{ env.REGISTRY }}
438+
username: ${{ github.actor }}
439+
password: ${{ secrets.GITHUB_TOKEN }}
440+
441+
- name: Extract metadata
442+
id: meta
443+
uses: docker/metadata-action@v5
444+
with:
445+
images: ${{ env.IMAGE_PREFIX }}/op-proposer-tee
446+
tags: |
447+
type=ref,event=branch
448+
type=ref,event=pr
449+
type=sha,prefix={{branch}}-,enable={{is_default_branch}}
450+
type=raw,value=latest,enable={{is_default_branch}}
451+
type=raw,value=pr-${{ github.event.number }},enable=${{ github.event_name == 'pull_request' }}
452+
453+
- name: Build and push OP Proposer TEE
454+
uses: docker/build-push-action@v5
455+
with:
456+
context: .
457+
file: espresso/docker/op-stack/Dockerfile
458+
target: op-proposer-target
459+
platforms: linux/amd64
460+
push: true
461+
tags: ${{ steps.meta.outputs.tags }}
462+
labels: ${{ steps.meta.outputs.labels }}
463+
build-args: |
464+
TARGET_BASE_IMAGE=alpine:3.22
465+
TARGETOS=linux
466+
TARGETARCH=amd64
467+

espresso/docker/op-batcher-tee/run-enclave.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ echo "Build completed successfully"
6969

7070
# Extract PCR0 from build output
7171
# Works whether the line is `... PCR0: 0xABCD ...` or `... PCR0=abcd123 ...`
72-
PCR0="$(sed -n -E 's/.*PCR0[:=][[:space:]]*(0[xX])?([[:xdigit:]]+).*/\2/p;q' /tmp/build_output.log)"
72+
PCR0="$(grep -m1 -oE 'PCR0[=:][[:space:]]*(0x)?[[:xdigit:]]{64,}' /tmp/build_output.log \
73+
| sed -E 's/^PCR0[=:][[:space:]]*(0x)?//')"
7374

7475

7576
# Get batch authenticator address from deployment state

espresso/scripts/shutdown.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ docker compose down -v
77

88
# Stop and remove containers built from op-batcher-tee:espresso image
99
echo "Stopping containers built from op-batcher-tee:espresso image..."
10-
CONTAINERS=$(docker ps -q --filter "ancestor=op-batcher-tee:espresso")
10+
CONTAINERS=$(docker ps -aq --filter "ancestor=op-batcher-tee:espresso")
1111
if [ ! -z "$CONTAINERS" ]; then
1212
echo "Stopping containers: $CONTAINERS"
1313
docker stop $CONTAINERS
@@ -17,6 +17,18 @@ else
1717
echo "No running containers found with op-batcher-tee:espresso image"
1818
fi
1919

20+
# Stop and remove containers built from op-proposer-tee:espresso image
21+
echo "Stopping containers built from op-proposer-tee:espresso image..."
22+
PROPOSER_CONTAINERS=$(docker ps -aq --filter "ancestor=op-proposer-tee:espresso")
23+
if [ ! -z "$PROPOSER_CONTAINERS" ]; then
24+
echo "Stopping containers: $PROPOSER_CONTAINERS"
25+
docker stop $PROPOSER_CONTAINERS 2>/dev/null || true
26+
docker rm $PROPOSER_CONTAINERS 2>/dev/null || true
27+
echo "Containers stopped and removed"
28+
else
29+
echo "No containers found with op-proposer-tee:espresso image"
30+
fi
31+
2032
# Stop and remove batcher-enclaver containers that run the eif
2133
echo "Stopping batcher-enclaver containers..."
2234
ENCLAVE_CONTAINERS=$(docker ps -aq --filter "name=batcher-enclaver-")

0 commit comments

Comments
 (0)