Skip to content

Commit 462ef7e

Browse files
committed
CI | pull noobaa-base image instead building it
Signed-off-by: nadav mizrahi <nadav.mizrahi16@gmail.com>
1 parent 4b1f6f5 commit 462ef7e

File tree

10 files changed

+97
-4
lines changed

10 files changed

+97
-4
lines changed

.github/workflows/ceph-nsfs-s3-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on: [workflow_call]
33

44
jobs:
55
nsfs-ceph-s3-tests:
6+
name: NSFS Ceph S3 Tests
67
runs-on: ubuntu-latest
78
timeout-minutes: 90
89
permissions:

.github/workflows/ceph-s3-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on: [workflow_call]
33

44
jobs:
55
ceph-s3-tests:
6+
name: Ceph S3 Tests
67
runs-on: ubuntu-latest
78
timeout-minutes: 90
89
permissions:

.github/workflows/nc_unit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on: [workflow_call]
33

44
jobs:
55
run-nc-unit-tests:
6+
name: Non Containerized Unit Tests
67
runs-on: ubuntu-latest
78
timeout-minutes: 90
89
permissions:

.github/workflows/postgres-unit-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on: [workflow_call]
33

44
jobs:
55
run-unit-tests-postgres:
6+
name: Unit Tests with Postgres
67
runs-on: ubuntu-latest
78
timeout-minutes: 90
89
permissions:

.github/workflows/run-pr-tests.yaml

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,112 @@ jobs:
4242
uses: ./.github/workflows/warp-nc-tests.yaml
4343

4444
build-noobaa-image:
45+
name: Build Noobaa Image
4546
runs-on: ubuntu-latest
4647
timeout-minutes: 90
4748
steps:
4849
- name: Checkout
4950
uses: actions/checkout@v4
5051

51-
- name: make noobaa image
52-
run: make tester
52+
- name: Prepare Tags
53+
id: prep
54+
run: |
55+
DOCKER_BUILDER_IMAGE=noobaa/noobaa-builder
56+
DOCKER_BASE_IMAGE=noobaa/noobaa-base
57+
if [[ -n ${{github.base_ref}} ]]; then
58+
#on pull request, use target branch
59+
BRANCH=${{github.base_ref}}
60+
else
61+
#on push, use the pushed branch
62+
BRANCH=${{github.ref_name}}
63+
fi
64+
echo ${BRANCH}
65+
BUILDER_TAGS="${DOCKER_BUILDER_IMAGE}:${BRANCH}-"
66+
BASE_TAGS="${DOCKER_BASE_IMAGE}:${BRANCH}-"
67+
EARLIEST_VERSION_PAST=20
68+
echo "basetags=${BASE_TAGS}" >> $GITHUB_OUTPUT
69+
echo "buildertags=${BUILDER_TAGS}" >> $GITHUB_OUTPUT
70+
echo "pull_tries=${EARLIEST_VERSION_PAST}" >> $GITHUB_OUTPUT
71+
72+
- name: Check changed files
73+
id: changed_files
74+
uses: tj-actions/changed-files@v44
75+
76+
- name: Should build noobaa base image
77+
id: should_build_base
78+
run: |
79+
base_files=("package.json" "base.dockerfile" ".nvmrc")
80+
output=false
81+
for file in ${{ steps.changed_files.outputs.all_changed_files }}; do
82+
if printf '%s\n' "${base_files[@]}" | grep -x -q "$file"; then
83+
echo "File ${file} has changed, building base image."
84+
output=true
85+
break;
86+
fi
87+
done
88+
echo "should_build=${output}" >> $GITHUB_OUTPUT
89+
90+
- name: Pull noobaa-base image
91+
id: pull_base_image
92+
if: ${{ steps.should_build_base.outputs.should_build == 'false' }}
93+
run: |
94+
output=false
95+
for i in $(seq 0 ${{ steps.prep.outputs.pull_tries }})
96+
do
97+
date=$(date -d "${i} days ago" +'%Y%m%d')
98+
base_tag="quay.io/${{ steps.prep.outputs.basetags }}${date}"
99+
echo ${base_tag}
100+
docker pull ${base_tag} || continue
101+
echo "Successfully pulled ${base_tag} from quay.io"
102+
docker tag ${base_tag} noobaa-base
103+
output=true
104+
break
105+
done
106+
echo "pull_succeed=${output}" >> $GITHUB_OUTPUT
107+
108+
- name: Pull noobaa-builder image
109+
id: should_build_builder
110+
if: ${{steps.should_build_base.outputs.should_build == 'true' ||
111+
steps.pull_base_image.outputs.pull_succeed == 'false'}}
112+
run: |
113+
output=true
114+
for i in $(seq 0 ${{ steps.prep.outputs.pull_tries }})
115+
do
116+
date=$(date -d "${i} days ago" +'%Y%m%d')
117+
builder_tag="quay.io/${{ steps.prep.outputs.buildertags }}${date}"
118+
docker pull ${builder_tag} || continue
119+
echo "Successfully pulled ${builder_tag} from quay.io"
120+
docker tag ${builder_tag} noobaa-builder
121+
output=false
122+
break
123+
done
124+
echo "should_build=${output}" >> $GITHUB_OUTPUT
125+
126+
- name: Build noobaa-base image
127+
if: ${{steps.should_build_base.outputs.should_build == 'true' ||
128+
steps.pull_base_image.outputs.pull_succeed == 'false'}}
129+
run: |
130+
if [ "${{ steps.should_build_builder.outputs.should_build }}" = 'false' ]; then
131+
flags="-o builder"
132+
fi
133+
make base ${flags}
134+
135+
- name: Build noobaa image
136+
run: make tester -o base
53137

54138
- name: create docker artifact
55139
run: |
56140
docker save --output noobaa.tar noobaa
57141
docker save --output noobaa-tester.tar noobaa-tester
58142
59-
- name: upload noobaa docker image
143+
- name: Upload noobaa docker image
60144
uses: actions/upload-artifact@v4
61145
with:
62146
name: noobaa-image
63147
path: noobaa.tar
64148
retention-days: "1"
65149

66-
- name: upload noobaa-tester docker image
150+
- name: Upload noobaa-tester docker image
67151
uses: actions/upload-artifact@v4
68152
with:
69153
name: noobaa-tester

.github/workflows/sanity-ssl.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on: [workflow_call]
33

44
jobs:
55
run-sanity-ssl-tests:
6+
name: Sanity SSL Tests
67
runs-on: ubuntu-latest
78
timeout-minutes: 90
89
permissions:

.github/workflows/sanity.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on: [workflow_call]
33

44
jobs:
55
run-sanity-tests:
6+
name: Sanity Tests
67
runs-on: ubuntu-latest
78
timeout-minutes: 90
89
permissions:

.github/workflows/unit.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on: [workflow_call]
33

44
jobs:
55
run-unit-tests:
6+
name: Unit Tests
67
runs-on: ubuntu-latest
78
timeout-minutes: 90
89
permissions:

.github/workflows/warp-nc-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: [workflow_call]
44

55
jobs:
66
warp-nc-tests:
7+
name: Warp NC Tests
78
runs-on: ubuntu-latest
89
timeout-minutes: 90
910
permissions:

.github/workflows/warp-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on: [workflow_call]
33

44
jobs:
55
warp-tests:
6+
name: Warp Tests
67
runs-on: ubuntu-latest
78
timeout-minutes: 90
89
permissions:

0 commit comments

Comments
 (0)