@@ -42,28 +42,111 @@ 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+           BUILDER_TAGS="${DOCKER_BUILDER_IMAGE}:${BRANCH}-" 
65+           BASE_TAGS="${DOCKER_BASE_IMAGE}:${BRANCH}-" 
66+           EARLIEST_VERSION_PAST=20 
67+           echo "basetags=${BASE_TAGS}" >> $GITHUB_OUTPUT 
68+           echo "buildertags=${BUILDER_TAGS}" >> $GITHUB_OUTPUT 
69+           echo "pull_tries=${EARLIEST_VERSION_PAST}" >> $GITHUB_OUTPUT 
70+ 
71+ name : Check changed files 
72+         id : changed_files 
73+         uses : tj-actions/changed-files@v44 
74+ 
75+       - name : Should build noobaa base image 
76+         id : should_build_base 
77+         run : | 
78+           base_files=("package.json" "base.dockerfile" ".nvmrc") 
79+           output=false 
80+           for file in ${{ steps.changed_files.outputs.all_changed_files }}; do 
81+             if printf '%s\n' "${base_files[@]}" | grep -x -q "$file"; then 
82+               echo "File ${file} has changed, building base image." 
83+               output=true 
84+               break; 
85+             fi 
86+           done 
87+           echo "should_build=${output}" >> $GITHUB_OUTPUT 
88+ 
89+ name : Pull noobaa-base image 
90+         id : pull_base_image 
91+         if : ${{ steps.should_build_base.outputs.should_build == 'false' }} 
92+         run : | 
93+           output=false 
94+           for i in $(seq 0 ${{ steps.prep.outputs.pull_tries }}) 
95+           do 
96+             date=$(date -d "${i} days ago" +'%Y%m%d') 
97+             base_tag="quay.io/${{ steps.prep.outputs.basetags }}${date}" 
98+             echo ${base_tag} 
99+             docker pull ${base_tag} || continue 
100+             echo "Successfully pulled ${base_tag} from quay.io" 
101+             docker tag ${base_tag} noobaa-base 
102+             output=true 
103+             break 
104+           done 
105+           echo "pull_succeed=${output}" >> $GITHUB_OUTPUT 
106+ 
107+ name : Pull noobaa-builder image 
108+         id : should_build_builder 
109+         if : ${{steps.should_build_base.outputs.should_build == 'true' || 
110+           steps.pull_base_image.outputs.pull_succeed == 'false'}} 
111+         run : | 
112+           output=true 
113+           for i in $(seq 0 ${{ steps.prep.outputs.pull_tries }}) 
114+           do 
115+             date=$(date -d "${i} days ago" +'%Y%m%d') 
116+             builder_tag="quay.io/${{ steps.prep.outputs.buildertags }}${date}" 
117+             docker pull ${builder_tag} || continue 
118+             echo "Successfully pulled ${builder_tag} from quay.io" 
119+             docker tag ${builder_tag} noobaa-builder 
120+             output=false 
121+             break 
122+           done 
123+           echo "should_build=${output}" >> $GITHUB_OUTPUT  
124+ 
125+ name : Build noobaa-base image 
126+         if : ${{steps.should_build_base.outputs.should_build == 'true' || 
127+           steps.pull_base_image.outputs.pull_succeed == 'false'}} 
128+         run : | 
129+           if [ "${{ steps.should_build_builder.outputs.should_build }}" = 'false' ]; then 
130+             flags="-o builder" 
131+           fi 
132+           make base ${flags} 
133+ 
134+ name : Build noobaa and tester images 
135+         run : make tester -o base 
53136
54137      - name : create docker artifact 
55138        run : | 
56139          docker save --output noobaa.tar noobaa 
57140          docker save --output noobaa-tester.tar noobaa-tester 
58141
59- name : upload  noobaa docker image
142+ name : Upload  noobaa docker image
60143        uses : actions/upload-artifact@v4 
61144        with :
62145          name : noobaa-image 
63146          path : noobaa.tar 
64147          retention-days : " 1" 
65148
66-       - name : upload  noobaa-tester docker image
149+       - name : Upload  noobaa-tester docker image
67150        uses : actions/upload-artifact@v4 
68151        with :
69152          name : noobaa-tester 
0 commit comments