Skip to content

Commit 8b4e77f

Browse files
committed
Update workflow
1 parent 69c6393 commit 8b4e77f

File tree

6 files changed

+55
-59
lines changed

6 files changed

+55
-59
lines changed

.github/workflows/build-&-publish-docker-image.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222
jobs:
2323
blobber:
2424
timeout-minutes: 30
25-
runs-on: [blobber-runner]
25+
runs-on: [hetzner-build]
2626
steps:
2727
- name: Cleanup before restarting conductor tests.
2828
run: |
@@ -52,9 +52,6 @@ jobs:
5252
with:
5353
fetch-depth: 0
5454

55-
- name: Set up Docker Buildx
56-
uses: docker/setup-buildx-action@v3
57-
5855
# - name: Login to Docker Hub
5956
# uses: docker/login-action@v1
6057
# with:
@@ -95,19 +92,19 @@ jobs:
9592
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8)
9693
export DOCKER_IMAGE_BASE="$BLOBBER_BUILD_BASE_REGISTRY:$TAG"
9794
export DOCKER_IMAGE_SWAGGER="${BLOBBER_REGISTRY}:swagger_test"
98-
# export DOCKER_BUILD="buildx build --platform linux/amd64,linux/arm64 --push"
99-
export DOCKER_BUILD="build --push"
95+
export DOCKER_BUILD="buildx build --load"
10096
export DOCKER_IMAGE_BLOBBER="-t ${BLOBBER_REGISTRY}:${TAG}"
10197
export CONTEXT_NAME="$RUNNER_NAME" && (docker context inspect "$CONTEXT_NAME" >/dev/null 2>&1 || docker context create "$CONTEXT_NAME")
10298
docker buildx inspect "blobber-$RUNNER_NAME" || docker buildx create --name "blobber-$RUNNER_NAME" --driver-opt network=host --buildkitd-flags '--allow-insecure-entitlement security.insecure' "$CONTEXT_NAME"
10399
docker buildx use "blobber-$RUNNER_NAME"
104100
./docker.local/bin/build.blobber.sh
105101
docker tag ${BLOBBER_REGISTRY}:${TAG} ${BLOBBER_REGISTRY}:${TAG}-${SHORT_SHA}
102+
docker push ${BLOBBER_REGISTRY}:${TAG}
106103
docker push ${BLOBBER_REGISTRY}:${TAG}-${SHORT_SHA}
107104
108105
validator:
109106
timeout-minutes: 30
110-
runs-on: [blobber-runner]
107+
runs-on: [hetzner-build]
111108
steps:
112109
- name: Cleanup before restarting conductor tests.
113110
run: |
@@ -143,8 +140,6 @@ jobs:
143140
with:
144141
fetch-depth: 0
145142

146-
- name: Set up Docker Buildx
147-
uses: docker/setup-buildx-action@v3
148143

149144
# - name: Get changed files using defaults
150145
# id: changed-files
@@ -181,20 +176,20 @@ jobs:
181176
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
182177
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8)
183178
export DOCKER_IMAGE_BASE="$BLOBBER_BUILD_BASE_REGISTRY:$TAG"
184-
# export DOCKER_BUILD="buildx build --platform linux/amd64,linux/arm64 --push"
185-
export DOCKER_BUILD="build --push"
179+
export DOCKER_BUILD="buildx build --load"
186180
export DOCKER_IMAGE_VALIDATOR="-t ${VALIDATOR_REGISTRY}:${TAG}"
187181
export CONTEXT_NAME="$RUNNER_NAME" && (docker context inspect "$CONTEXT_NAME" >/dev/null 2>&1 || docker context create "$CONTEXT_NAME")
188182
docker buildx inspect "validator-$RUNNER_NAME" || docker buildx create --name "validator-$RUNNER_NAME" --driver-opt network=host --buildkitd-flags '--allow-insecure-entitlement security.insecure' "$CONTEXT_NAME"
189183
docker buildx use "validator-$RUNNER_NAME"
190184
./docker.local/bin/build.validator.sh
191185
docker tag ${VALIDATOR_REGISTRY}:${TAG} ${VALIDATOR_REGISTRY}:${TAG}-${SHORT_SHA}
186+
docker push ${VALIDATOR_REGISTRY}:${TAG}
192187
docker push ${VALIDATOR_REGISTRY}:${TAG}-${SHORT_SHA}
193188
194189
system-tests:
195190
if: github.event_name != 'workflow_dispatch'
196191
needs: [blobber, validator]
197-
runs-on: [ tests-suite ]
192+
runs-on: [ hetzner-testsuite ]
198193
steps:
199194
- name: "Get current PR"
200195
uses: jwalton/gh-find-current-pr@v1

.github/workflows/build-for-conductor-testing.yml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ env:
1919

2020
jobs:
2121
build_blobber_for_conductor_testing:
22-
runs-on: [self-hosted, arc-runner]
22+
runs-on: [hetzner-build]
2323
steps:
2424
- name: Cleanup before restarting conductor tests.
2525
run: |
2626
echo 'y' | docker system prune -a
2727
rm -rf *
2828
cd /tmp
2929
rm -rf ./*
30+
3031
- name: Set docker image tag
3132
run: |
3233
if [[ "${{github.ref}}" == refs/pull/* ]]; then
@@ -39,26 +40,9 @@ jobs:
3940
echo "BRANCH=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo ${GITHUB_REF#refs/*/} || echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV
4041
echo "SHA=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo $GITHUB_SHA || echo '${{ github.event.pull_request.head.sha }}')" >> $GITHUB_ENV
4142
42-
- name: Setup go
43-
uses: actions/setup-go@v3
44-
with:
45-
go-version: ^1.21 # The Go version to download (if necessary) and use.
46-
4743
- name: Clone blobber
48-
uses: actions/checkout@v1
44+
uses: actions/checkout@v3
4945

50-
- name: Set up Docker Buildx
51-
run: |
52-
sudo apt-get update -y
53-
sudo apt-get install wget
54-
sudo apt-get install ca-certificates curl gnupg lsb-release -y
55-
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
56-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
57-
sudo apt-get update -y
58-
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
59-
export DOCKER_CLI_EXPERIMENTAL=enabled
60-
docker run --privileged --rm tonistiigi/binfmt --install all
61-
docker context create blobber_buildx
6246
- name: Login to Docker Hub
6347
uses: docker/login-action@v1
6448
with:
@@ -68,9 +52,5 @@ jobs:
6852
- name: Testing blobber & validator builds for conductor testing
6953
run: |
7054
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8)
71-
# export DOCKER_IMAGE_BASE="${BLOBBER_REGISTRY}:base"
72-
# export DOCKER_IMAGE_SWAGGER="${BLOBBER_REGISTRY}:swagger_test"
73-
# export DOCKER_BUILD="buildx build --platform linux/amd64,linux/arm64 --push"
74-
# export DOCKER_IMAGE_BLOBBER="-t ${BLOBBER_REGISTRY}:${TAG} -t ${BLOBBER_REGISTRY}:${TAG}-${SHORT_SHA}"
75-
docker buildx create --driver-opt network=host --use --buildkitd-flags '--allow-insecure-entitlement security.insecure' --use blobber_buildx
76-
./docker.local/bin/build.base.sh && ./docker.local/bin/build.blobber-integration-tests.sh
55+
docker buildx create --name blobber_buildx --driver-opt network=host --buildkitd-flags '--allow-insecure-entitlement security.insecure' --use || docker buildx use blobber_buildx
56+
./docker.local/bin/build.base.sh && ./docker.local/bin/build.blobber-integration-tests.sh

.github/workflows/tests.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,19 @@ on:
1212
jobs:
1313
linter:
1414
name: Lints
15-
runs-on: [self-hosted,blobber-runner]
15+
runs-on: [hetzner-build]
16+
env:
17+
HOME: /root
18+
GOCACHE: /root/.cache/go-build
19+
GOPATH: /root/go
1620
steps:
17-
# - name: Setup go
18-
# uses: actions/setup-go@v3
19-
# with:
20-
# go-version: ^1.22 # The Go version to download (if necessary) and use.
21-
2221
- name: Clone blobber
23-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
2423

2524
- name: Install Packages
2625
run: |
2726
sudo apt-get update
28-
sudo apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev
29-
sudo apt-get install wget
27+
sudo apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget
3028
3129
- name: Buf-lint
3230
if: success()
@@ -35,7 +33,6 @@ jobs:
3533
- name: Build Base
3634
run: |
3735
./docker.local/bin/build.base.sh
38-
golangci-lint cache clean
3936
4037
- name: Golangci-lint
4138
uses: golangci/golangci-lint-action@v3
@@ -46,20 +43,23 @@ jobs:
4643
skip-pkg-cache: true
4744
skip-build-cache: true
4845

49-
5046
unit-tests:
5147
name: Unit Tests
52-
runs-on: [self-hosted,arc-runner]
48+
runs-on: [hetzner-testsuite]
49+
env:
50+
HOME: /root
51+
GOCACHE: /root/.cache/go-build
52+
GOPATH: /root/go
5353
steps:
54+
- name: Clone blobber
55+
uses: actions/checkout@v3
56+
5457
- name: Setup go
5558
uses: actions/setup-go@v3
5659
with:
57-
go-version: ^1.22 # The Go version to download (if necessary) and use.
58-
59-
- name: Clone blobber
60-
uses: actions/checkout@v2
60+
go-version: ^1.22
6161

62-
- name: Install Make Command
62+
- name: Install Dependencies
6363
run: |
6464
sudo apt-get update
6565
sudo apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget
@@ -68,10 +68,10 @@ jobs:
6868
run: |
6969
cd $GITHUB_WORKSPACE/code/go/0chain.net/
7070
CGO_ENABLED=1 go test -tags bn256 -race -coverprofile=coverage.txt -covermode=atomic ./...
71+
7172
- name: Upload coverage to Codecov
7273
uses: codecov/codecov-action@v2
7374
with:
74-
# fail_ci_if_error: true
7575
files: ./code/go/0chain.net/coverage.txt
7676
flags: Unit-Tests
77-
verbose: true
77+
verbose: true

docker.local/bin/build.base.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,11 @@ echo "2> download herumi"
2727
[ ! -f ./docker.local/bin/bls.tar.gz ] && wget -O ./docker.local/bin/bls.tar.gz https://github.com/herumi/bls/archive/refs/tags/v1.22.tar.gz
2828

2929
echo "3> docker build"
30-
DOCKER_BUILDKIT=1 docker $DOCKER_BUILD --progress=plain --build-arg GIT_COMMIT=$GIT_COMMIT -f docker.local/base.Dockerfile . -t $DOCKER_IMAGE_BASE --network host
30+
# Set flags based on build type
31+
if [[ "$DOCKER_BUILD" == *"buildx"* ]]; then
32+
BUILD_FLAGS="--progress=plain"
33+
else
34+
BUILD_FLAGS=""
35+
fi
36+
37+
docker $DOCKER_BUILD $BUILD_FLAGS --build-arg GIT_COMMIT=$GIT_COMMIT -f docker.local/base.Dockerfile . -t $DOCKER_IMAGE_BASE --network host

docker.local/bin/build.blobber.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,11 @@ echo ""
3333
# docker.local/bin/test.swagger.sh
3434

3535
echo "2> docker build blobber"
36-
DOCKER_BUILDKIT=1 docker $DOCKER_BUILD --progress=plain --build-arg GIT_COMMIT=$GIT_COMMIT --build-arg DOCKER_IMAGE_BASE=$DOCKER_IMAGE_BASE -f docker.local/blobber.Dockerfile . $DOCKER_IMAGE_BLOBBER --network host
36+
# Set flags based on build type
37+
if [[ "$DOCKER_BUILD" == *"buildx"* ]]; then
38+
BUILD_FLAGS="--progress=plain"
39+
else
40+
BUILD_FLAGS=""
41+
fi
42+
43+
docker $DOCKER_BUILD $BUILD_FLAGS --build-arg GIT_COMMIT=$GIT_COMMIT --build-arg DOCKER_IMAGE_BASE=$DOCKER_IMAGE_BASE -f docker.local/blobber.Dockerfile . $DOCKER_IMAGE_BLOBBER --network host

docker.local/bin/build.validator.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,11 @@ echo " DOCKER_IMAGE_VALIDATOR=$DOCKER_IMAGE_VALIDATOR"
2828

2929
echo ""
3030
echo "2> docker build validator"
31-
DOCKER_BUILDKIT=1 docker $DOCKER_BUILD --progress=plain --build-arg GIT_COMMIT=$GIT_COMMIT --build-arg DOCKER_IMAGE_BASE=$DOCKER_IMAGE_BASE -f docker.local/validator.Dockerfile . $DOCKER_IMAGE_VALIDATOR
31+
# Set flags based on build type
32+
if [[ "$DOCKER_BUILD" == *"buildx"* ]]; then
33+
BUILD_FLAGS="--progress=plain"
34+
else
35+
BUILD_FLAGS=""
36+
fi
37+
38+
docker $DOCKER_BUILD $BUILD_FLAGS --build-arg GIT_COMMIT=$GIT_COMMIT --build-arg DOCKER_IMAGE_BASE=$DOCKER_IMAGE_BASE -f docker.local/validator.Dockerfile . $DOCKER_IMAGE_VALIDATOR

0 commit comments

Comments
 (0)