1818 outputs :
1919 image_tag : ${{ steps.vars.outputs.commit_hash }}
2020 tar_file : ${{ steps.vars.outputs.tar_file }}
21- image_name : ${{ steps.vars.outputs.artifact_name }}
21+ image_name : ${{ steps.vars.outputs.image_name }}
2222 steps :
2323 - name : Checkout repository
2424 uses : actions/checkout@v4
@@ -28,24 +28,21 @@ jobs:
2828 run : |
2929 commit_hash=$(git rev-parse --short HEAD)
3030 tar_file="ndc-openapi-${commit_hash}.tar"
31- artifact_name ="ndc-openapi- ${commit_hash}"
31+ image_name ="ndc-openapi: ${commit_hash}"
3232 echo "commit_hash=$commit_hash" >> $GITHUB_ENV
3333 echo "tar_file=$tar_file" >> $GITHUB_ENV
34- echo "artifact_name=$artifact_name" >> $GITHUB_ENV
35- echo "::set-output name=commit_hash::$commit_hash"
36- echo "::set-output name=tar_file::$tar_file"
37- echo "::set-output name=artifact_name::$artifact_name"
34+ echo "image_name=$image_name" >> $GITHUB_ENV
3835
3936 - name : Set up Docker Buildx
4037 uses : docker/setup-buildx-action@v3
4138
4239 - name : Build Docker image
4340 run : |
44- docker build -t ndc-openapi:$commit_hash .
41+ docker build -t $image_name .
4542
4643 - name : Save Docker image as artifact
4744 run : |
48- docker save -o $tar_file ndc-openapi:$commit_hash
45+ docker save -o $tar_file $image_name
4946
5047 - name : Upload Docker image artifact
5148 uses : actions/upload-artifact@v4
7067 - name : Run Trivy vulnerability scan
7168 uses : aquasecurity/trivy-action@master
7269 with :
73- image-ref : ' ndc-openapi: ${{ needs.build-docker-image.outputs.image_tag }}'
70+ image-ref : ' ${{ needs.build-docker-image.outputs.image_name }}'
7471 format : ' table'
7572 exit-code : 1
7673 severity : ' CRITICAL,HIGH'
0 commit comments