-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95edd92
commit 27bea09
Showing
9 changed files
with
168 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Publish Antithesis Images | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
REGISTRY: us-central1-docker.pkg.dev | ||
REPOSITORY: molten-verve-216720/avalanche-repository | ||
NODE_NAME: avalanche-node | ||
WORKLOAD_NAME: workload | ||
CONFIG_NAME: config | ||
TAG: latest | ||
|
||
jobs: | ||
antithesis: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to GAR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: _json_key | ||
password: ${{ secrets.ANTITHESIS_GAR_JSON_KEY }} | ||
|
||
- name: Build node | ||
id: build-node-image | ||
run: | | ||
docker build -t $REGISTRY/$REPOSITORY/$NODE_NAME:$TAG -f ./tests/antithesis/Dockerfile.node . | ||
echo "name=image::$REGISTRY/$REPOSITORY/$NODE_NAME:$TAG" >> $GITHUB_OUTPUT | ||
- name: Build workload | ||
id: build-workload-image | ||
run: | | ||
docker build -t $REGISTRY/$REPOSITORY/$WORKLOAD_NAME:$TAG -f ./tests/antithesis/Dockerfile.workload . | ||
echo "name=image::$REGISTRY/$REPOSITORY/$WORKLOAD_NAME:$TAG" >> $GITHUB_OUTPUT | ||
- name: Build config | ||
id: build-config-image | ||
run: | | ||
docker build -t $REGISTRY/$REPOSITORY/$CONFIG_NAME:$TAG -f ./tests/antithesis/Dockerfile.config . | ||
echo "name=image::$REGISTRY/$REPOSITORY/$CONFIG_NAME:$TAG" >> $GITHUB_OUTPUT | ||
- name: Publish images | ||
run: | | ||
docker push ${REGISTRY}/${REPOSITORY}/${NODE_NAME}:${TAG} | ||
docker push ${REGISTRY}/${REPOSITORY}/${WORKLOAD_NAME}:${TAG} | ||
docker push ${REGISTRY}/${REPOSITORY}/${CONFIG_NAME}:${TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# Directory above this script | ||
AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) | ||
# Load the constants | ||
source "$AVALANCHE_PATH"/scripts/constants.sh | ||
|
||
echo "Building Workload..." | ||
go build -o "$AVALANCHE_PATH/build/workload" "$AVALANCHE_PATH/tests/antithesis/"*.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
|
||
COPY ./tests/antithesis/docker-compose.yml /docker-compose.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Antithesis: Getting the Antithesis golang instrumentation library | ||
FROM docker.io/antithesishq/go-instrumentor AS instrumentor | ||
|
||
# Changes to the minimum golang version must also be replicated in | ||
# scripts/build_avalanche.sh | ||
# tests/antithesis/Dockerfile.node (here) | ||
# Dockerfile | ||
# README.md | ||
# go.mod | ||
# ============= Compilation Stage ================ | ||
FROM golang:1.21.8-bullseye AS builder | ||
|
||
WORKDIR /build | ||
# Copy and download avalanche dependencies using go mod | ||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
# Copy the code into the container | ||
COPY . . | ||
|
||
# Keep the commit hash to easily verify the exact version that is running | ||
RUN git rev-parse HEAD > ./commit_hash.txt | ||
|
||
# Copy the instrumentor and supporting files to their correct locations | ||
COPY --from=instrumentor /opt/antithesis /opt/antithesis | ||
COPY --from=instrumentor /opt/antithesis/lib /lib | ||
|
||
# Create the destination output directory for the instrumented code | ||
RUN mkdir -p /avalanchego_instrumented | ||
|
||
# Park the .git file in a safe location | ||
RUN mkdir -p /opt/tmp/ | ||
RUN cp -r .git /opt/tmp/ | ||
|
||
# Instrument avalanchego | ||
RUN /opt/antithesis/bin/goinstrumentor \ | ||
-stderrthreshold=INFO \ | ||
-antithesis /opt/antithesis/instrumentation \ | ||
. \ | ||
/avalanchego_instrumented | ||
|
||
WORKDIR /avalanchego_instrumented/customer | ||
RUN go mod download | ||
RUN ln -s /opt/tmp/.git .git | ||
|
||
# Build avalanchego with race detection (-r) enabled. | ||
RUN ./scripts/build.sh -r | ||
|
||
# ============= Cleanup Stage ================ | ||
FROM debian:11-slim AS execution | ||
|
||
# Copy identifying information into the container | ||
COPY --from=builder /build/commit_hash.txt ./commit_hash.txt | ||
|
||
# Copy the antithesis dependencies into the container | ||
RUN mkdir -p /symbols | ||
COPY --from=builder /avalanchego_instrumented/symbols /symbols | ||
COPY --from=builder /opt/antithesis/lib/libvoidstar.so /usr/lib/libvoidstar.so | ||
|
||
# Copy the executable into the container | ||
COPY --from=builder /avalanchego_instrumented/customer/build/avalanchego ./avalanchego | ||
|
||
CMD [ "./avalanchego" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Changes to the minimum golang version must also be replicated in | ||
# scripts/build_avalanche.sh | ||
# tests/antithesis/Dockerfile.node | ||
# tests/antithesis/Dockerfile.workload (here) | ||
# Dockerfile | ||
# README.md | ||
# go.mod | ||
# ============= Compilation Stage ================ | ||
FROM golang:1.21.8-bullseye AS builder | ||
|
||
WORKDIR /build | ||
# Copy and download avalanche dependencies using go mod | ||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
# Copy the code into the container | ||
COPY . . | ||
|
||
# Build the workload | ||
RUN ./scripts/build_antithesis_workload.sh | ||
|
||
# ============= Cleanup Stage ================ | ||
FROM debian:11-slim AS execution | ||
|
||
# Copy the executable into the container | ||
COPY --from=builder /build/build/workload ./workload | ||
|
||
CMD [ "./workload" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters