Updated build script

This commit is contained in:
Alexey Pustovalov 2021-10-09 08:53:59 +02:00
parent 103ea5e099
commit 1e598415e0

View File

@ -206,25 +206,31 @@ jobs:
docker build --label org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} ` docker build --label org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} `
--label org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} ` --label org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} `
--file=$dockerfile ` --file=$dockerfile `
--build-arg=BUILD_BASE_IMAGE=${{ steps.base_build.outputs.base_build_image }}
$tags ` $tags `
$context $context
if (-not $?) {throw "Failed"} if (-not $?) {throw "Failed"}
- name: Push image
run: |
$tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") )
Foreach ($tag in $tags_array) { Foreach ($tag in $tags_array) {
echo "docker image push $tag"
docker image push $tag docker image push $tag
if (-not $?) {throw "Failed"} if (-not $?) {throw "Failed"}
} }
- name: Image digest
run: |
$tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") )
$digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1] $digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1]
if (-not $?) {throw "Failed"} if (-not $?) {throw "Failed"}
echo $digest echo $digest
$digest | Set-Content -Path ${{ env.COMPONENT_BASE_BUILD_NAME }}${{ env.COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX }} $digest | Set-Content -Path ${{ env.COMPONENT_BASE_BUILD_NAME }}${{ env.COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX }}
- name: Logout from DockerHub
run: |
docker logout
if (-not $?) {throw "Failed"}
- name: Upload SHA256 tag - name: Upload SHA256 tag
uses: actions/upload-artifact@v2.2.4 uses: actions/upload-artifact@v2.2.4
with: with:
@ -232,6 +238,11 @@ jobs:
path: ${{ env.COMPONENT_BASE_BUILD_NAME }}${{ env.COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX }} path: ${{ env.COMPONENT_BASE_BUILD_NAME }}${{ env.COMPONENT_BASE_BUILD_ARTIFACT_FILE_SUFFIX }}
if-no-files-found: error if-no-files-found: error
- name: Logout from DockerHub
run: |
docker logout
if (-not $?) {throw "Failed"}
build_images: build_images:
timeout-minutes: 70 timeout-minutes: 70
needs: [ "build_components", "init_build"] needs: [ "build_components", "init_build"]
@ -291,17 +302,28 @@ jobs:
docker build --label org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} ` docker build --label org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} `
--label org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} ` --label org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} `
--file=$dockerfile ` --file=$dockerfile `
--build-arg=BUILD_BASE_IMAGE=${{ steps.base_build.outputs.base_build_image }}
$tags ` $tags `
$context $context
if (-not $?) {throw "Failed"} if (-not $?) {throw "Failed"}
- name: Push image
run: |
$tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") )
Foreach ($tag in $tags_array) { Foreach ($tag in $tags_array) {
echo "docker image push $tag"
docker image push $tag docker image push $tag
if (-not $?) {throw "Failed"} if (-not $?) {throw "Failed"}
} }
- name: Image digest
run: |
$tags_array=$( "${{ steps.meta.outputs.tags }}".Split("`r`n") )
$digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1] $digest=$(docker inspect $tags_array[0] --format "{{ index .RepoDigests 0}}").Split('@')[-1]
if (-not $?) {throw "Failed"} if (-not $?) {throw "Failed"}
echo $digest echo $digest
- name: Logout from DockerHub - name: Logout from DockerHub