Skip to content

Commit

Permalink
2024-06-12 10:14 - updates ci:debug
Browse files Browse the repository at this point in the history
  • Loading branch information
saxix committed Jun 12, 2024
1 parent 6acc9c5 commit db52bf3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 23 deletions.
13 changes: 9 additions & 4 deletions .github/actions/image_updated/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ outputs:
build_date:
description: 'Returns tha image build date'
value: ${{ steps.check.outputs.build_date }}
version:
description: 'Returns tha image build date'
value: ${{ steps.check.outputs.version }}

runs:
using: 'composite'
Expand All @@ -48,11 +51,13 @@ runs:
architecture=${{ inputs.architecture }}
repo="${ref%:*}"
tag="${ref##*:}"
version
echo "::debug::REF:${ref}"
echo "::debug::REPO:${repo}"
echo "::debug::TAG:${tag}"
echo "::debug::ARCH:${architecture}"
echo "::notice::REF:${ref}"
echo "::notice::REPO:${repo}"
echo "::notice::TAG:${tag}"
echo "::notice::ARCH:${architecture}"
echo "::notice::VER:${version}"
echo "image=$ref" >> $GITHUB_OUTPUT
echo "repo=$repo" >> $GITHUB_OUTPUT
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ on:
required: false
type: string
default: false
version:
description: "Docker version"
required: true
type: string
target:
description: "Dockerfile stage to stop to"
required: true
Expand Down Expand Up @@ -85,6 +89,7 @@ jobs:
echo image : ${{steps.setup.outputs.image}}
echo tag : ${{inputs.image}}
echo target : ${{inputs.target}}
echo version : ${{steps.image_updated.outputs.version}}
echo target-checksum : ${{inputs.checksum}}
echo docker-checksum : ${{steps.image_updated.outputs.checksum }}
echo image_exists : ${{steps.image_updated.outputs.exists}}
Expand Down Expand Up @@ -118,13 +123,13 @@ jobs:
file: ./docker/Dockerfile
platforms: linux/amd64
outputs: type=registry
cache-from: "type=registry,ref=${{inputs.image}}-buildcache,ref=${{steps.setup.outputs.image}}:test-develop,mode=max"
cache-from: "type=registry,ref=${{inputs.image}}-buildcache,mode=max"
cache-to: "type=registry,ref=${{inputs.image}}-buildcache,mode=max"
labels: BuildNumber=${{ steps.setup.outputs.build_number }},
build-args: |
BUILD_DATE=${{ steps.setup.outputs.date }}
CHECKSUM=${{ steps.release_hash.outputs.hash }}
VERSION=${{ steps.version.outputs.version }}
VERSION=${{ inputs.version }}
SOURCE_COMMIT=${{ env.LAST_COMMIT_SHA }}
GITHUB_SERVER_URL=${{ github.server_url }}
GITHUB_REPOSITORY=${{ github.repository }}
Expand Down
35 changes: 19 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 3
outputs:
test_files: ${{ steps.changes.outputs.run_tests }}
docker: ${{ steps.changes.outputs.docker_base }}
python_files: ${{ steps.changes.outputs.python }}
branch: ${{ steps.extract_branch.outputs.branch }}
hash: ${{ steps.release_hash.outputs.hash }}
tags: ${{ steps.meta.outputs.tags }}
version: ${{ steps.meta.outputs.version }}
image_name: ${{ steps.image_name.outputs.name }}
# test_files: ${{ steps.changes.outputs.run_tests }}
# docker: ${{ steps.changes.outputs.docker_base }}
# python_files: ${{ steps.changes.outputs.python }}
# branch: ${{ steps.extract_branch.outputs.branch }}
hash: ${{ steps.docker_image.outputs.checksum }}
# tags: ${{ steps.meta.outputs.tags }}
version: ${{ steps.docker_image.outputs.version }}
image_name: ${{ steps.docker_image.outputs.name }}
steps:
- run: git config --global --add safe.directory $(realpath .)
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand All @@ -48,25 +48,28 @@ jobs:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml
- id: extract_branch
name: Extract branch name
# shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- id: release_hash
uses: ./.github/actions/distro_hash
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
- name: Define target image name
id: image_name
id: docker_image
run: |
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
version="${branch##*/}"
echo "name=${{vars.DOCKER_IMAGE}}:test-${{steps.meta.outputs.version}}" >> $GITHUB_OUTPUT
echo "tag=test-${{steps.meta.outputs.version}}" >> $GITHUB_OUTPUT
echo "checksum=${{ steps.release_hash.outputs.hash }}" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
echo "branch=$branch" >> $GITHUB_OUTPUT
- id: image_updated
name: Check if image exists and updated
uses: ./.github/actions/image_updated
with:
image: ${{steps.image_name.outputs.name}}
checksum: ${{needs.setup.outputs.hash}}
image: ${{steps.docker_image.outputs.name}}
checksum: ${{steps.docker_image.outputs.checksum}}
username: ${{ secrets.username }}
password: ${{ secrets.password }}

Expand All @@ -77,8 +80,8 @@ jobs:
secrets: inherit
with:
image: ${{needs.setup.outputs.image_name}}
cache-from: ${{needs.setup.outputs.image_name}}
checksum: ${{needs.setup.outputs.hash}}
version: ${{needs.setup.outputs.version}}
target: "python_dev_deps"

test:
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ RUN <<EOF cat> /RELEASE
"commit": "$SOURCE_COMMIT",
"date": "$BUILD_DATE",
"checksum": "$CHECKSUM",
"source": "${GITHUB_SERVER_URL}/$${GITHUB_REPOSITORY}/tree/${SOURCE_COMMIT:-master}/"
"source": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/${SOURCE_COMMIT:-master}/"
}
EOF

Expand Down

0 comments on commit db52bf3

Please sign in to comment.