From 8af7c465bb502814d67a48de435172a8db553975 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Wed, 5 Jun 2024 22:08:42 +1000 Subject: [PATCH] build: Push to correct registry & Housekeeping --- .drone.yml | 51 -------------- .gitea/workflows/actions.yaml | 43 ++++++++++-- .gitea/workflows/actions.yaml.disabled | 92 -------------------------- Dockerfile | 7 +- 4 files changed, 38 insertions(+), 155 deletions(-) delete mode 100644 .drone.yml delete mode 100644 .gitea/workflows/actions.yaml.disabled diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 7a882e4..0000000 --- a/.drone.yml +++ /dev/null @@ -1,51 +0,0 @@ -kind: pipeline -type: kubernetes -name: Harbor - -steps: -- name: build & publish - image: plugins/docker - context: . - settings: - repo: bv11-cr01.bessems.eu/library/packer-extended - registry: bv11-cr01.bessems.eu - tags: latest - mtu: 1450 - username: - from_secret: harbor_username - password: - from_secret: harbor_password - build_args_from_env: - - REPO_USERNAME - - REPO_PASSWORD - environment: - REPO_USERNAME: - from_secret: repo_username - REPO_PASSWORD: - from_secret: repo_password - ---- -kind: pipeline -type: kubernetes -name: Dockerhub - -steps: -- name: build & publish - image: plugins/docker - context: . - settings: - repo: djpbessems/packer-extended - tags: latest - mtu: 1450 - username: - from_secret: docker_username - password: - from_secret: docker_password - build_args_from_env: - - REPO_USERNAME - - REPO_PASSWORD - environment: - REPO_USERNAME: - from_secret: repo_username - REPO_PASSWORD: - from_secret: repo_password diff --git a/.gitea/workflows/actions.yaml b/.gitea/workflows/actions.yaml index aaa55ca..6d8b4cc 100644 --- a/.gitea/workflows/actions.yaml +++ b/.gitea/workflows/actions.yaml @@ -43,7 +43,7 @@ jobs: echo 'Release tag set correctly: ${{ steps.sem_rel.outputs.version }}'; exit 0 } - build-image: + build_image: name: Container image runs-on: dind needs: semrel_dryrun @@ -51,10 +51,11 @@ jobs: steps: - name: Check out repository code uses: actions/checkout@v4 - - name: Install QEMU - run: | - sudo apt-get update - sudo apt-get install -y qemu-user-static + - name: Set up qemu + uses: docker/setup-qemu-action@v3 + # run: | + # sudo apt-get update + # sudo apt-get install -y qemu-user-static - name: Create builder context id: buildx-context run: | @@ -79,14 +80,14 @@ jobs: uses: docker/login-action@v3 with: registry: code.spamasaurus.com - username: ${{ gitea.actor }} + username: ${{ secrets.GIT_USERNAME }} password: ${{ secrets.GIT_APIKEY }} - name: Build & push container image uses: docker/build-push-action@v5 with: push: true context: . - tags: djpbessems/packer-extended:${{ needs.semrel_dryrun.outputs.version }} + tags: code.spamasaurus.com/djpbessems/packer-extended:${{ needs.semrel_dryrun.outputs.version }} build-args: | REPO_USERNAME=${{ secrets.REPO_USERNAME }} REPO_PASSWORD=${{ secrets.REPO_PASSWORD }} @@ -95,3 +96,31 @@ jobs: DOCKER_TLS_CERTDIR: "/certs" DOCKER_TLS_VERIFY: 1 DOCKER_CERT_PATH: "/certs/client" + + semrel: + name: Semantic Release + runs-on: dind-rootless + needs: build_image + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Install dependencies + run: | + npm install \ + semantic-release \ + @semantic-release/changelog \ + @semantic-release/commit-analyzer \ + @semantic-release/git \ + @semantic-release/release-notes-generator + - name: Semantic Release + run: | + npx semantic-release \ + --branches ${{ gitea.refname }} \ + --tag-format 'v${version}' \ + --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/changelog,@semantic-release/git + env: + GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }} diff --git a/.gitea/workflows/actions.yaml.disabled b/.gitea/workflows/actions.yaml.disabled deleted file mode 100644 index 1cd8dc7..0000000 --- a/.gitea/workflows/actions.yaml.disabled +++ /dev/null @@ -1,92 +0,0 @@ -name: Container -on: [push] - -jobs: - semrel_dryrun: - name: Semantic Release (Dry-run) - runs-on: dind-rootless - outputs: - version: ${{ steps.sem_rel.outputs.version }} - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 20 - - name: Install dependencies - run: | - npm install \ - semantic-release \ - @semantic-release/commit-analyzer \ - @semantic-release/exec - - name: Semantic Release (dry-run) - id: sem_rel - run: | - npx semantic-release \ - --package @semantic-release/exec \ - --package semantic-release \ - --branches ${{ gitea.refname }} \ - --tag-format 'v${version}' \ - --dry-run \ - --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ - --analyzeCommits @semantic-release/commit-analyzer \ - --verifyRelease @semantic-release/exec \ - --verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT' - env: - GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }} - - name: Assert semantic release output - run: | - [[ -z "${{ steps.sem_rel.outputs.version }}" ]] && { - echo 'No release tag - exiting'; exit 1 - } || { - echo 'Release tag set correctly: ${{ steps.sem_rel.outputs.version }}'; exit 0 - } - - build_container: - name: Container image - # container: catthehacker/ubuntu:act-latest - # runs-on: dind - # needs: semrel_dryrun - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - # - name: Kaniko build - # uses: aevea/action-kaniko@master - # with: - # extra_args: | - # --build-arg REPO_USERNAME=${{ secrets.REPO_USERNAME }} \ - # --build-arg REPO_PASSWORD=${{ secrets.REPO_PASSWORD }} - # registry: code.spamasaurus.com - # image: djpbessems/packer-extended - # username: ${{ secrets.GIT_USERNAME }} - # password: ${{ secrets.GIT_APIKEY }} - # tag: ${{ needs.semrel_dryrun.outputs.version }} - - semrel: - name: Semantic Release - runs-on: dind-rootless - needs: build_container - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 20 - - name: Install dependencies - run: | - npm install \ - semantic-release \ - @semantic-release/changelog \ - @semantic-release/commit-analyzer \ - @semantic-release/git \ - @semantic-release/release-notes-generator - - name: Semantic Release - run: | - npx semantic-release \ - --branches ${{ gitea.refname }} \ - --tag-format 'v${version}' \ - --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/changelog,@semantic-release/git - env: - GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }} diff --git a/Dockerfile b/Dockerfile index caaeaad..bc2e708 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,9 +10,6 @@ ARG REPO_USERNAME ARG REPO_PASSWORD ADD https://${REPO_USERNAME}:${REPO_PASSWORD}@sn.itch.fyi/Repository/bin/VMware/ovftool/4.4.x/${OVFTOOL_INSTALLER} /tmp/ovftool-installer -RUN apk --update add --no-cache \ - openssl && \ - openssl s_client -connect api.github.com:443 -msg -tls1_2 RUN apk --update add --no-cache \ curl \ jq && \ @@ -73,8 +70,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ pyvmomi \ requests && \ update-ca-certificates --fresh && \ - pwsh -Command "Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Trusted' -Verbose" && \ - pwsh -Command "Install-Module -Name 'powershell-yaml','VMware.PowerCLI' -Verbose" && \ + pwsh -Command "Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Trusted'" && \ + pwsh -Command "Install-Module -Name 'powershell-yaml','VMware.PowerCLI'" && \ pwsh -Command "Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP \$False -Confirm:\$False" && \ sh /tmp/ovftool-installer --console --eulas-agreed --required && \ apt-get remove -y \