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

Publish docker images with race detection #2680

Merged
merged 2 commits into from
Jan 30, 2024
Merged
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/publish_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd )
source "$AVALANCHE_PATH"/scripts/constants.sh

# Build current avalanchego
source "$AVALANCHE_PATH"/scripts/build_image.sh -r
StephenButtolph marked this conversation as resolved.
Show resolved Hide resolved
source "$AVALANCHE_PATH"/scripts/build_image.sh

if [[ $current_branch == "master" ]]; then
echo "Tagging current avalanchego image as $avalanchego_dockerhub_repo:latest"
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ RUN go mod download
COPY . .

# Build avalanchego
RUN ./scripts/build.sh
ARG RACE_FLAG=""
RUN ./scripts/build.sh ${RACE_FLAG}

# ============= Cleanup Stage ================
FROM debian:11-slim AS execution
Expand Down
9 changes: 9 additions & 0 deletions scripts/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
# Load the constants
source "$AVALANCHE_PATH"/scripts/constants.sh

if [[ $current_branch == *"-race" ]]; then
echo "Branch name must not end in '-race'"
exit 1
fi

# WARNING: this will use the most recent commit even if there are un-committed changes present
full_commit_hash="$(git --git-dir="$AVALANCHE_PATH/.git" rev-parse HEAD)"
commit_hash="${full_commit_hash::8}"

echo "Building Docker Image with tags: $avalanchego_dockerhub_repo:$commit_hash , $avalanchego_dockerhub_repo:$current_branch"
docker build -t "$avalanchego_dockerhub_repo:$commit_hash" \
-t "$avalanchego_dockerhub_repo:$current_branch" "$AVALANCHE_PATH" -f "$AVALANCHE_PATH/Dockerfile"

echo "Building Docker Image with tags: $avalanchego_dockerhub_repo:$commit_hash-race , $avalanchego_dockerhub_repo:$current_branch-race"
docker build --build-arg="RACE_FLAG=-r" -t "$avalanchego_dockerhub_repo:$commit_hash-race" \
-t "$avalanchego_dockerhub_repo:$current_branch-race" "$AVALANCHE_PATH" -f "$AVALANCHE_PATH/Dockerfile"
Loading