From 7de2025193237df8df0bf8269b7e178d49bac7a9 Mon Sep 17 00:00:00 2001 From: sax Date: Fri, 14 Jun 2024 18:13:29 +0200 Subject: [PATCH] 2024-06-14 18:13 - updates --- .github/actions/docker_info/action.yml | 34 -------- .github/actions/env/action.yml | 51 ------------ .github/actions/hash/action.yml | 24 ------ .github/actions/image_exists/action.yml | 43 ---------- .github/actions/image_updated/action.yml | 4 - .github/actions/version/action.xyml | 99 ------------------------ .github/actions/version/action.yml | 82 -------------------- 7 files changed, 337 deletions(-) delete mode 100644 .github/actions/docker_info/action.yml delete mode 100644 .github/actions/env/action.yml delete mode 100644 .github/actions/hash/action.yml delete mode 100644 .github/actions/image_exists/action.yml delete mode 100644 .github/actions/version/action.xyml delete mode 100644 .github/actions/version/action.yml diff --git a/.github/actions/docker_info/action.yml b/.github/actions/docker_info/action.yml deleted file mode 100644 index a450f404..00000000 --- a/.github/actions/docker_info/action.yml +++ /dev/null @@ -1,34 +0,0 @@ -# ref: https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action -name: 'Retrieve Docker Image Information' -description: 'Calculate deps and os hash' -inputs: - image: - description: 'Files to use to calculate the hash' - required: true - username: - description: '' - required: true - password: - description: '' - required: true - -runs: - using: 'composite' - steps: -# - name: Configure Git -# shell: bash -# run: git config --global --add safe.directory $(realpath .) -# - name: ch -# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: docker/login-action@v3 - with: - username: ${{ inputs.username }} - password: ${{ inputs.password }} - - name: Calculate Release Hash - shell: bash - run: | - docker pull ${{inputs.image}} - echo "----------" - docker inspect --format='{{json .Config.Labels}}' ${{inputs.image}} - docker run -t ${{inputs.image}} release-info.sh - echo "----------" diff --git a/.github/actions/env/action.yml b/.github/actions/env/action.yml deleted file mode 100644 index d45fdb19..00000000 --- a/.github/actions/env/action.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: 'version' -description: '' - -outputs: - stage: - description: '' - value: ${{ steps.version.outputs.stage }} - version: - description: '' - value: ${{ steps.version.outputs.version }} - commit: - description: '' - value: ${{ steps.version.outputs.commit }} - release: - description: '' - value: ${{ steps.version.outputs.release }} - date: - description: '' - value: ${{ steps.build_date.outputs.date }} - today: - description: '' - value: ${{ steps.build_date.outputs.today }} - timestamp: - description: '' - value: ${{ steps.build_date.outputs.timestamp }} - branch: - description: '' - value: ${{ steps.extract_branch.outputs.branch }} - - -runs: - using: 'composite' - steps: - - shell: bash --noprofile --norc -eo pipefail {0} - run: git config --global --add safe.directory $(realpath .) - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - id: version - uses: ./.github/actions/version - - id: extract_branch - name: Extract branch name - shell: bash - run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT - - id: build_date - shell: bash --noprofile --norc -eo pipefail -ux {0} - run: | - d1=$(date +"%a,%e %b %Y %H:%M %Z") - d2=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - d3=$(date -u +"%Y%m%d%H%M%S") - echo "today=$d1" >> $GITHUB_OUTPUT - echo "date=$d2" >> $GITHUB_OUTPUT - echo "timestamp=$d3" >> $GITHUB_OUTPUT diff --git a/.github/actions/hash/action.yml b/.github/actions/hash/action.yml deleted file mode 100644 index 00da682f..00000000 --- a/.github/actions/hash/action.yml +++ /dev/null @@ -1,24 +0,0 @@ -# ref: https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action -name: 'Calculate version hash' -description: 'Calculate deps and os hash' -inputs: - files: - description: 'Files to use to calculate the hash' - required: true - default: "pdm.lock docker/bin/* docker/conf/* docker/Dockerfile" -outputs: - hash: # id of output - description: 'The time we greeted you' - value: ${{ steps.calc.outputs.hash }} - -runs: - using: 'composite' -# args: -# - ${{ inputs.files }} - steps: - - name: Calculate release hash - id: calc - shell: bash --noprofile --norc -eo pipefail -ux {0} - run: | - LOCK_SHA=$(echo sha1sum ${{ inputs.files }} | sha1sum | awk '{print $1}' | cut -c 1-8) - echo "hash=$LOCK_SHA" >> "$GITHUB_OUTPUT" diff --git a/.github/actions/image_exists/action.yml b/.github/actions/image_exists/action.yml deleted file mode 100644 index 6457dfb3..00000000 --- a/.github/actions/image_exists/action.yml +++ /dev/null @@ -1,43 +0,0 @@ -# ref: https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action -name: 'Che cif image exists in dockerhub' -description: 'Calculate deps and os hash' -inputs: - image: - description: 'Docker Image ' - required: true - username: - description: 'DockerHub username ' - required: true - password: - description: 'DockerHub password ' - required: true - -outputs: - exists: - description: 'The time we greeted you' - value: ${{ steps.check.outputs.exixts }} - -runs: - using: 'composite' -# args: -# - ${{ inputs.files }} - steps: - - name: DockerHub login - uses: docker/login-action@v3 - with: - username: ${{ inputs.username }} - password: ${{ inputs.password }} - - name: Check Image Exists - id: check - continue-on-error: true - shell: bash --noprofile --norc -eo pipefail -ux {0} - run: | - set +e - exists=$(docker manifest inspect ${{inputs.image}} > /dev/null 2>&1 && echo "exists" || echo "not_found") - if [ $exists = "exists" ];then - echo "exists=true" >> "$GITHUB_OUTPUT" - echo "Image ${{inputs.image}} found" - else - echo "exists=false" >> "$GITHUB_OUTPUT" - echo "Image ${{inputs.image}} does not exist" - fi diff --git a/.github/actions/image_updated/action.yml b/.github/actions/image_updated/action.yml index f3b57ea3..c0fd10a3 100644 --- a/.github/actions/image_updated/action.yml +++ b/.github/actions/image_updated/action.yml @@ -8,10 +8,6 @@ inputs: checksum: description: 'checksum' required: true - label: - description: 'checksum label' - default: 'checksum' - required: false username: description: 'DockerHub username ' required: false diff --git a/.github/actions/version/action.xyml b/.github/actions/version/action.xyml deleted file mode 100644 index 63be76db..00000000 --- a/.github/actions/version/action.xyml +++ /dev/null @@ -1,99 +0,0 @@ -name: 'version' -description: '' - -outputs: - stage: - description: 'The time we greeted you' - value: ${{ steps.parser.outputs.stage }} - version: - description: 'The time we greeted you' - value: ${{ steps.parser.outputs.version }} - commit: - description: 'The time we greeted you' - value: ${{ steps.parser.outputs.commit }} - sha: - description: 'The time we greeted you' - value: ${{ steps.parser.outputs.sha }} - - -runs: - using: 'composite' - steps: - - name: Configure Git - shell: bash - run: | - git config --global --add safe.directory $(realpath .) - - name: ch - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Parse branch - shell: bash - id: parser - run: | - # BASE=$(git describe --all --exact-match 2>/dev/null | sed 's=.*/==') - # BASE="1.2.3-rc1" - # VERSION="${BASE#[vV]}" - # VERSION_MAJOR="${VERSION%%.*}" - # VERSION_MINOR_PATCH="${VERSION#*.}" - # VERSION_MINOR="${VERSION_MINOR_PATCH%%.*}" - # VERSION_PATCH_PRE_RELEASE="${VERSION_MINOR_PATCH#*.}" - # VERSION_PATCH="${VERSION_PATCH_PRE_RELEASE%%[-+]*}" - # VERSION_PRE_RELEASE="" - # - # case "$VERSION" in - # *rc) - # VERSION_PRE_RELEASE="${VERSION#rc}" - # VERSION_PRE_RELEASE="${VERSION_PRE_RELEASE%%+*}" - # ;; - # *-*) - # VERSION_PRE_RELEASE="${VERSION#*-}" - # VERSION_PRE_RELEASE="${VERSION_PRE_RELEASE%%+*}" - # ;; - # esac - if [[ "${{ github.event_name }}" == pull_request ]]; then - sha=$(git rev-parse --short ${{ github.event.pull_request.head.sha }}) - elif [[ "${{ github.event_name }}" == push ]]; then - sha="${GITHUB_SHA}" - else - sha="not-available" - fi - - commit="${{ github.sha }}" - - if [[ ${{github.ref_name}} == develop ]]; then - stage=dev - version="${GITHUB_SHA::7}" - release=snapshot - elif [[ ${{github.ref_name}} == master ]]; then - stage=final - version=11111 - elif [[ ${{github.ref_name}} == releases/* ]]; then - stage=rc - version=${GITHUB_SHA::7} - elif [[ ${{github.ref_name}} == tags/* ]]; then - stage=final - version=${GITHUB_SHA::7} - else - stage=a - version=${GITHUB_SHA::7} - fi - - cat <> $GITHUB_OUTPUT - echo "stage=$stage" >> $GITHUB_OUTPUT - echo "release=$release" >> $GITHUB_OUTPUT - echo "sha=$sha" >> $GITHUB_OUTPUT - echo "commit=$commit" >> $GITHUB_OUTPUT -# -# - name: Describe -# id: describe -# shell: bash --noprofile --norc -eo pipefail -ux {0} -# run: | -# echo ${{ steps.branch.version }} -# ver=$(`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:"%h" -1`) -# echo "version=$ver" >> $GITHUB_OUTPUT diff --git a/.github/actions/version/action.yml b/.github/actions/version/action.yml deleted file mode 100644 index 5b8628a9..00000000 --- a/.github/actions/version/action.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: 'version' -description: '' - -outputs: - stage: - description: 'Docker stage to use' - value: ${{ steps.parser.outputs.stage }} - version: - description: 'Docker T' - value: ${{ steps.parser.outputs.version }} - commit: - description: 'The time we greeted you' - value: ${{ steps.parser.outputs.commit }} - sha: - description: 'The time we greeted you' - value: ${{ steps.parser.outputs.sha }} - - -runs: - using: 'composite' - steps: - - name: Configure Git - shell: bash --noprofile --norc -eo pipefail {0} - run: git config --global --add safe.directory $(realpath .) - - name: ch - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Parse branch - shell: bash --noprofile --norc -eo pipefail -ux {0} - id: parser - run: | - release="not-available" - sha="not-available" - - if [[ ${{ github.event_name }} == pull_request ]]; then - sha=$(git rev-parse --short ${{ github.event.pull_request.head.sha }}) - elif [[ "${{ github.event_name }}" == push ]]; then - sha="${GITHUB_SHA}" - else - sha="not-available" - fi - - commit="${{ github.sha }}" - - if [[ ${{github.ref_name}} == develop ]]; then - stage=dev - version="${GITHUB_SHA::7}" - release=snapshot - elif [[ ${{github.ref_name}} == master ]]; then - stage=final - version=11111 - elif [[ ${{github.ref_name}} == releases/* ]]; then - stage=rc - version=${GITHUB_SHA::7} - elif [[ ${{github.ref_name}} == tags/* ]]; then - stage=final - version=${GITHUB_SHA::7} - else - stage=a - version=${GITHUB_SHA::7} - fi - - cat <> $GITHUB_OUTPUT - echo "version=$version" >> $GITHUB_OUTPUT - echo "stage=$stage" >> $GITHUB_OUTPUT - echo "release=$release" >> $GITHUB_OUTPUT - echo "sha=$sha" >> $GITHUB_OUTPUT - echo "commit=$commit" >> $GITHUB_OUTPUT -# -# - name: Describe -# id: describe -# shell: bash --noprofile --norc -eo pipefail -ux {0} -# run: | -# echo ${{ steps.branch.version }} -# ver=$(`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:"%h" -1`) -# echo "version=$ver" >> $GITHUB_OUTPUT