Skip to content

Commit e6a3a91

Browse files
Publish docker images with race detection (#2680)
1 parent cf6935a commit e6a3a91

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.github/workflows/publish_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd )
1414
source "$AVALANCHE_PATH"/scripts/constants.sh
1515

1616
# Build current avalanchego
17-
source "$AVALANCHE_PATH"/scripts/build_image.sh -r
17+
source "$AVALANCHE_PATH"/scripts/build_image.sh
1818

1919
if [[ $current_branch == "master" ]]; then
2020
echo "Tagging current avalanchego image as $avalanchego_dockerhub_repo:latest"

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ RUN go mod download
1616
COPY . .
1717

1818
# Build avalanchego
19-
RUN ./scripts/build.sh
19+
ARG RACE_FLAG=""
20+
RUN ./scripts/build.sh ${RACE_FLAG}
2021

2122
# ============= Cleanup Stage ================
2223
FROM debian:11-slim AS execution

scripts/build_image.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@ AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
88
# Load the constants
99
source "$AVALANCHE_PATH"/scripts/constants.sh
1010

11+
if [[ $current_branch == *"-race" ]]; then
12+
echo "Branch name must not end in '-race'"
13+
exit 1
14+
fi
15+
1116
# WARNING: this will use the most recent commit even if there are un-committed changes present
1217
full_commit_hash="$(git --git-dir="$AVALANCHE_PATH/.git" rev-parse HEAD)"
1318
commit_hash="${full_commit_hash::8}"
1419

1520
echo "Building Docker Image with tags: $avalanchego_dockerhub_repo:$commit_hash , $avalanchego_dockerhub_repo:$current_branch"
1621
docker build -t "$avalanchego_dockerhub_repo:$commit_hash" \
1722
-t "$avalanchego_dockerhub_repo:$current_branch" "$AVALANCHE_PATH" -f "$AVALANCHE_PATH/Dockerfile"
23+
24+
echo "Building Docker Image with tags: $avalanchego_dockerhub_repo:$commit_hash-race , $avalanchego_dockerhub_repo:$current_branch-race"
25+
docker build --build-arg="RACE_FLAG=-r" -t "$avalanchego_dockerhub_repo:$commit_hash-race" \
26+
-t "$avalanchego_dockerhub_repo:$current_branch-race" "$AVALANCHE_PATH" -f "$AVALANCHE_PATH/Dockerfile"

0 commit comments

Comments
 (0)