diff --git a/.github/actions/image_updated/action.yml b/.github/actions/image_updated/action.yml index 6154ecf0..2d310f77 100644 --- a/.github/actions/image_updated/action.yml +++ b/.github/actions/image_updated/action.yml @@ -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' @@ -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 diff --git a/.github/workflows/_build.yml b/.github/workflows/_build.yml index 91d47bb7..d96741d5 100644 --- a/.github/workflows/_build.yml +++ b/.github/workflows/_build.yml @@ -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 @@ -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}} @@ -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 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3eff2a41..97e294ad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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 }} @@ -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: diff --git a/docker/Dockerfile b/docker/Dockerfile index 0844267a..9c0a5445 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -202,7 +202,7 @@ RUN < /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