From 4a7ceb541b7a5f0c02dc5994b3fb8b9ada70ff25 Mon Sep 17 00:00:00 2001 From: "pierre.geeraert" Date: Tue, 22 Sep 2026 13:19:00 +0100 Subject: [PATCH] add the image downloader --- .gitea/workflows/dockerfile_runner.yaml | 98 ------------------- .gitea/workflows/image_downloader_runner.yaml | 41 ++++++++ 2 files changed, 41 insertions(+), 98 deletions(-) delete mode 100644 .gitea/workflows/dockerfile_runner.yaml create mode 100644 .gitea/workflows/image_downloader_runner.yaml diff --git a/.gitea/workflows/dockerfile_runner.yaml b/.gitea/workflows/dockerfile_runner.yaml deleted file mode 100644 index 84e65ae..0000000 --- a/.gitea/workflows/dockerfile_runner.yaml +++ /dev/null @@ -1,98 +0,0 @@ -name: Dockerfile runner -run-name: Building and deploying to Prod 🚀 -on: - push: - branches: - - main - paths-ignore: - - 'infra/production/dockerfile' - issue_comment: - types: [created] - workflow_dispatch: # Enables the manual run UI button - -jobs: - Explore-Gitea-Actions: - env: - RUNNER_TOOL_CACHE: /toolcache - DEBUG: True - ALLOWED_HOSTS: "django.tryton.geeraert.eu" - container: - image: gitea.tryton.geeraert.eu/pi-ux-ce/custom-runner-debian-slim:1.0.6 - volumes: - - act-toolcache:/opt/hostedtoolcache # this is where Runner store their cache default - runs-on: host-runner - steps: - - - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - - - name: restore git folder if exist - run: if [ -d "/opt/hostedtoolcache/${{ github.event.repository.name }}/" ]; then cp -r /opt/hostedtoolcache/${{ github.event.repository.name }}/ ${{ gitea.workspace }}; fi - - - name: Check Docker Version - run: whereis docker - - - name: Check out repository code - uses: actions/checkout@v4 - clean: false - fetch-depth: 1 - ref: 'main' - -# - name: Manually check out repository code -# run: cd ${{ gitea.workspace }} ; git pull origin main - - - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - - - name: List files in the repository - run: | - ls ${{ gitea.workspace }} - - - name: Compute next version - id: versioning - run: | - latest="${{ vars.VERSION }}" - next_version=$(echo "$latest" | awk -F. -v OFS=. '{$NF += 1 ; print}') - echo "next_version=$next_version" >> $GITHUB_ENV - echo "Variables used :" - echo "------------------------------------------------" - echo "Next version: $next_version" - - - name: Login to gitea - uses: docker/login-action@v3 - with: - registry: gitea.tryton.geeraert.eu - username: ${{ secrets.USERNAME_GITEA }} - password: ${{ secrets.PASSWORD_GITEA }} - - - name: Build image - run: | - docker build \ - -f infra/production/dockerfile \ - --build-arg ALLOWED_HOSTS='django.tryton.geeraert.eu' \ - --build-arg DEBUG='True' \ - -t gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest \ - -t gitea.tryton.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }} \ - . - - - name: Push image - run: | - docker push gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest - docker push gitea.tryton.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }} - - - name: Rollout Django to force pulling the new image - uses: actions-hub/kubectl@master - env: - KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} - with: - args: rollout restart deployment django -n django - - - run: echo "🍏 This job's status is ${{ job.status }}." - - - name: update version in the variable - run: | - curl -X PUT -H "Content-Type: application/json" \ - --user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \ - https://gitea.tryton.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/VERSION \ - -d "{\"Value\":\"$next_version\"}" - - - name: backup git for future use - run: cp -r ${{ gitea.workspace }} /opt/hostedtoolcache/${{ github.event.repository.name }}/ diff --git a/.gitea/workflows/image_downloader_runner.yaml b/.gitea/workflows/image_downloader_runner.yaml new file mode 100644 index 0000000..97a0eb8 --- /dev/null +++ b/.gitea/workflows/image_downloader_runner.yaml @@ -0,0 +1,41 @@ +name: image puller runner +run-name: Pull and Push 🚀 +on: + push: + workflow_dispatch: # Enables the manual run UI button + +jobs: + Explore-Gitea-Actions: + env: + RUNNER_TOOL_CACHE: /toolcache + DEBUG: True + ALLOWED_HOSTS: "django.tryton.geeraert.eu" + container: + image: gitea.tryton.geeraert.eu/pi-ux-ce/custom-runner-debian-slim:1.0.6 + volumes: + - act-toolcache:/opt/hostedtoolcache # this is where Runner store their cache default + runs-on: host-runner + steps: + + - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + + - name: Check out repository code + uses: actions/checkout@v4 + + + - name: cat list + run: | + cat image_list.txt + + - name: Login to gitea + uses: docker/login-action@v3 + with: + registry: gitea.tryton.geeraert.eu + username: ${{ secrets.USERNAME_GITEA }} + password: ${{ secrets.PASSWORD_GITEA }} + +# - name: Push image +# run: | +# docker push gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest +# docker push gitea.tryton.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }} +