66 tag :
77 description : " Image Tag"
88 default : " latest"
9+ pull_request :
10+ branches :
11+ - master
912 push :
1013 branches :
1114 - master
@@ -41,58 +44,40 @@ jobs:
4144 echo ::set-output name=version::${VERSION}
4245 - name : Docker meta for kubesphere
4346 id : meta
44- uses : docker/metadata-action@v3
47+ uses : docker/metadata-action@v5
4548 with :
4649 images : |
4750 kubesphere/devops-controller
4851 tags : ${{ steps.prepare.outputs.version }}
4952 - name : Set up QEMU
50- uses : docker/setup-qemu-action@v1
53+ uses : docker/setup-qemu-action@v3
5154 - name : Set up Docker Buildx
52- uses : docker/setup-buildx-action@v1
55+ uses : docker/setup-buildx-action@v3
5356 - name : Login to DockerHub
54- if : github.event_name != 'pull_request'
55- uses : docker/login-action@v1
57+ uses : docker/login-action@v3
5658 with :
5759 username : ${{ secrets.DOCKER_HUB_USER }}
5860 password : ${{ secrets.DOCKER_HUB_SECRETS }}
5961 - name : Build env
6062 id : build_env
6163 run : |
62- if [ " ${{ github.event_name }}" == "pull_request " ]
64+ if [ ${{ github.ref_type }} == "tag " ]
6365 then
64- echo "::set-output name=platforms::linux/amd64"
65- echo "::set-output name=push::false"
66- echo "::set-output name=load::true"
67- echo "::set-output name=ref::pr-$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")"
68- else
6966 echo "::set-output name=platforms::linux/amd64,linux/arm64"
70- echo "::set-output name=push::true"
71- echo "::set-output name=load::false"
72- echo "::set-output name=ref::${{github.ref_name}}"
67+ else
68+ echo "::set-output name=platforms::linux/amd64"
7369 fi
70+ echo "::set-output name=push::true"
71+ echo "::set-output name=ref::${{github.ref_name}}"
7472 echo "::set-output name=short_sha::${GITHUB_SHA::7}"
7573 - name : Build and push Docker images
76- uses : docker/build-push-action@v2.4.0
74+ uses : docker/build-push-action@v6
7775 with :
7876 file : config/dockerfiles/controller-manager/Dockerfile
7977 tags : ${{ steps.meta.outputs.tags }}
8078 push : ${{ steps.build_env.outputs.push }}
81- load : ${{ steps.build_env.outputs.load }}
8279 labels : ${{ steps.meta.outputs.labels }}
8380 platforms : ${{ steps.build_env.outputs.platforms }}
84- provenance : false
85- sbom : false
86- - name : Run Trivy vulnerability scanner
87- uses :
aquasecurity/[email protected] 88- if : github.event_name == 'pull_request'
89- with :
90- image-ref : ' docker.io/kubesphere/devops-controller:${{ steps.build_env.outputs.ref }}-${{ steps.build_env.outputs.short_sha }}'
91- format : ' table'
92- exit-code : ' 1'
93- ignore-unfixed : true
94- vuln-type : ' os,library'
95- severity : ' CRITICAL,HIGH'
9681
9782 BuildAPIServer :
9883 runs-on : ubuntu-latest
@@ -111,58 +96,40 @@ jobs:
11196 echo ::set-output name=version::${VERSION}
11297 - name : Docker meta for kubesphere
11398 id : meta
114- uses : docker/metadata-action@v3
99+ uses : docker/metadata-action@v5
115100 with :
116101 images : |
117102 kubesphere/devops-apiserver
118103 tags : ${{ steps.prepare.outputs.version }}
119104 - name : Set up QEMU
120- uses : docker/setup-qemu-action@v1
105+ uses : docker/setup-qemu-action@v3
121106 - name : Set up Docker Buildx
122- uses : docker/setup-buildx-action@v1
107+ uses : docker/setup-buildx-action@v3
123108 - name : Login to DockerHub
124- if : github.event_name != 'pull_request'
125- uses : docker/login-action@v1
109+ uses : docker/login-action@v3
126110 with :
127111 username : ${{ secrets.DOCKER_HUB_USER }}
128112 password : ${{ secrets.DOCKER_HUB_SECRETS }}
129113 - name : Build env
130114 id : build_env
131115 run : |
132- if [ " ${{ github.event_name }}" == "pull_request " ]
116+ if [ ${{ github.ref_type }} == "tag " ]
133117 then
134- echo "::set-output name=platforms::linux/amd64"
135- echo "::set-output name=push::false"
136- echo "::set-output name=load::true"
137- echo "::set-output name=ref::pr-$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")"
138- else
139118 echo "::set-output name=platforms::linux/amd64,linux/arm64"
140- echo "::set-output name=push::true"
141- echo "::set-output name=load::false"
142- echo "::set-output name=ref::${{github.ref_name}}"
119+ else
120+ echo "::set-output name=platforms::linux/amd64"
143121 fi
122+ echo "::set-output name=push::true"
123+ echo "::set-output name=ref::${{github.ref_name}}"
144124 echo "::set-output name=short_sha::${GITHUB_SHA::7}"
145125 - name : Build and push Docker images
146- uses : docker/build-push-action@v2.4.0
126+ uses : docker/build-push-action@v6
147127 with :
148128 file : config/dockerfiles/apiserver/Dockerfile
149129 tags : ${{ steps.meta.outputs.tags }}
150130 push : ${{ steps.build_env.outputs.push }}
151- load : ${{ steps.build_env.outputs.load }}
152131 labels : ${{ steps.meta.outputs.labels }}
153132 platforms : ${{ steps.build_env.outputs.platforms }}
154- provenance : false
155- sbom : false
156- - name : Run Trivy vulnerability scanner
157- uses :
aquasecurity/[email protected] 158- if : github.event_name == 'pull_request'
159- with :
160- image-ref : ' docker.io/kubesphere/devops-apiserver:${{ steps.build_env.outputs.ref }}-${{ steps.build_env.outputs.short_sha }}'
161- format : ' table'
162- exit-code : ' 1'
163- ignore-unfixed : true
164- vuln-type : ' os,library'
165- severity : ' CRITICAL,HIGH'
166133
167134 BuildTools :
168135 runs-on : ubuntu-latest
@@ -181,55 +148,37 @@ jobs:
181148 echo ::set-output name=version::${VERSION}
182149 - name : Docker meta for kubesphere
183150 id : meta
184- uses : docker/metadata-action@v3
151+ uses : docker/metadata-action@v5
185152 with :
186153 images : |
187154 kubesphere/devops-tools
188155 tags : ${{ steps.prepare.outputs.version }}
189156 - name : Set up QEMU
190- uses : docker/setup-qemu-action@v1
157+ uses : docker/setup-qemu-action@v3
191158 - name : Set up Docker Buildx
192- uses : docker/setup-buildx-action@v1
159+ uses : docker/setup-buildx-action@v3
193160 - name : Login to DockerHub
194- if : github.event_name != 'pull_request'
195- uses : docker/login-action@v1
161+ uses : docker/login-action@v3
196162 with :
197163 username : ${{ secrets.DOCKER_HUB_USER }}
198164 password : ${{ secrets.DOCKER_HUB_SECRETS }}
199165 - name : Build env
200166 id : build_env
201167 run : |
202- if [ " ${{ github.event_name }}" == "pull_request " ]
168+ if [ ${{ github.ref_type }} == "tag " ]
203169 then
204- echo "::set-output name=platforms::linux/amd64"
205- echo "::set-output name=push::false"
206- echo "::set-output name=load::true"
207- echo "::set-output name=ref::pr-$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")"
208- else
209170 echo "::set-output name=platforms::linux/amd64,linux/arm64"
210- echo "::set-output name=push::true"
211- echo "::set-output name=load::false"
212- echo "::set-output name=ref::${{github.ref_name}}"
171+ else
172+ echo "::set-output name=platforms::linux/amd64"
213173 fi
174+ echo "::set-output name=push::true"
175+ echo "::set-output name=ref::${{github.ref_name}}"
214176 echo "::set-output name=short_sha::${GITHUB_SHA::7}"
215177 - name : Build and push Docker images
216- uses : docker/build-push-action@v2.4.0
178+ uses : docker/build-push-action@v6
217179 with :
218180 file : config/dockerfiles/tools/Dockerfile
219181 tags : ${{ steps.meta.outputs.tags }}
220182 push : ${{ steps.build_env.outputs.push }}
221- load : ${{ steps.build_env.outputs.load }}
222183 labels : ${{ steps.meta.outputs.labels }}
223184 platforms : ${{ steps.build_env.outputs.platforms }}
224- provenance : false
225- sbom : false
226- - name : Run Trivy vulnerability scanner
227- uses :
aquasecurity/[email protected] 228- if : github.event_name == 'pull_request'
229- with :
230- image-ref : ' docker.io/kubesphere/devops-tools:${{ steps.build_env.outputs.ref }}-${{ steps.build_env.outputs.short_sha }}'
231- format : ' table'
232- exit-code : ' 1'
233- ignore-unfixed : true
234- vuln-type : ' os,library'
235- severity : ' CRITICAL,HIGH'
0 commit comments