From 7807b342b5a3c0ef98c4cc26696aa57cb718571b Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 18:40:00 -0700 Subject: [PATCH 01/11] feat: Add werf integration --- .github/workflows/pull_request.yaml | 20 +++++++++----------- werf.yaml | 10 ++++++++++ 2 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 werf.yaml diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index a89c5d0..94d8dbf 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -14,15 +14,13 @@ jobs: - name: Check Out Repo uses: actions/checkout@v2 - # QEMU is needed to support multi-platform builds - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Build - uses: docker/build-push-action@v2 + - uses: werf/actions/install@v2 with: - push: false # don't push to Dockerhub for all PRs - platforms: linux/amd64,linux/arm64 # ensure builds succeed for both platforms + version: v2.14.0 + + - name: Run script + run: | + . $(werf ci-env github --as-file) + werf build + env: + WERF_DISABLE_AUTO_HOST_CLEANUP: "1" diff --git a/werf.yaml b/werf.yaml new file mode 100644 index 0000000..1a0c459 --- /dev/null +++ b/werf.yaml @@ -0,0 +1,10 @@ +project: aladdin +configVersion: 1 +build: + platform: + - linux/arm64 + - linux/amd64 +--- +image: aladdin +context: . +dockerfile: Dockerfile From b6b3737eb6ce12500d4587db08e05054c34f587a Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:05:36 -0700 Subject: [PATCH 02/11] use ghcr --- .github/workflows/pull_request.yaml | 19 +++++++++-- .github/workflows/release.yaml | 49 +++++++++++++++-------------- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 94d8dbf..02924ec 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -2,13 +2,23 @@ # At this time it only ensures the docker image is buildable # In the future it could run linting, tests, etc name: Pull Request + on: pull_request: branches: - main + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write steps: - name: Check Out Repo @@ -18,9 +28,12 @@ jobs: with: version: v2.14.0 - - name: Run script + - name: werf build + env: + WERF_DISABLE_AUTO_HOST_CLEANUP: "1" run: | . $(werf ci-env github --as-file) + + werf cr login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} + werf build - env: - WERF_DISABLE_AUTO_HOST_CLEANUP: "1" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index cdadd30..e7c1d93 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,5 +1,6 @@ # This workflow is setup to build and publish aladdin to Dockerhub name: Push to Docker Hub + on: push: branches: @@ -7,48 +8,50 @@ on: tags: - '*.*.*' - '*.*.*.*' -jobs: +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write steps: - name: Check Out Repo uses: actions/checkout@v2 - # QEMU is needed to support multi-platform builds - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - # this will select the right tags depending on the Github event - # master branch will build the "latest" and "master" Dockerhub tags + # master branch will build the "latest" and "main" Dockerhub tags # git tags will build the Dockerhub tag matching the git tag - name: Docker meta id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: fivestarsos/aladdin tags: | type=ref,event=branch type=ref,event=tag - - name: Login to Docker Hub - uses: docker/login-action@v1 + - uses: actions/github-script@v7 + id: werf-args with: - # these creds are setup in the repository secrets - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + result-encoding: string + script: | + const tags = '${{ steps.meta.outputs.tags }}'.split(',') - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + return tags.map((tag) => `--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${tag}`) - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - push: true # push to Dockerhub - platforms: linux/amd64,linux/arm64 - tags: ${{ steps.meta.outputs.tags }} + - name: werf publish + env: + WERF_DISABLE_AUTO_HOST_CLEANUP: "1" + run: | + . $(werf ci-env github --as-file) + + werf cr login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} + werf export --repo fivestarsos/aladdin ${{steps.werf-args.outputs.result}} From 27eccad5ddd6d91d2e702d54f5f2b8c88b14b0e3 Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:07:58 -0700 Subject: [PATCH 03/11] add qemu --- .github/workflows/pull_request.yaml | 4 ++++ .github/workflows/release.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 02924ec..cda2d6c 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -24,6 +24,10 @@ jobs: - name: Check Out Repo uses: actions/checkout@v2 + # QEMU is needed to support multi-platform builds + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - uses: werf/actions/install@v2 with: version: v2.14.0 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e7c1d93..3ec1dcc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,6 +25,10 @@ jobs: - name: Check Out Repo uses: actions/checkout@v2 + # QEMU is needed to support multi-platform builds + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + # this will select the right tags depending on the Github event # master branch will build the "latest" and "main" Dockerhub tags # git tags will build the Dockerhub tag matching the git tag From 5cd9c2662290e2218830cc37dd6f89575d550937 Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:15:31 -0700 Subject: [PATCH 04/11] buildah? --- .github/workflows/pull_request.yaml | 1 + .github/workflows/release.yaml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index cda2d6c..b74c1ab 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -35,6 +35,7 @@ jobs: - name: werf build env: WERF_DISABLE_AUTO_HOST_CLEANUP: "1" + WERF_BUILDAH_MODE: auto run: | . $(werf ci-env github --as-file) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3ec1dcc..bf90bd3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -29,6 +29,10 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 + - uses: werf/actions/install@v2 + with: + version: v2.14.0 + # this will select the right tags depending on the Github event # master branch will build the "latest" and "main" Dockerhub tags # git tags will build the Dockerhub tag matching the git tag @@ -53,6 +57,7 @@ jobs: - name: werf publish env: WERF_DISABLE_AUTO_HOST_CLEANUP: "1" + WERF_BUILDAH_MODE: auto run: | . $(werf ci-env github --as-file) From f5dc7cd33bf078147b1c88cb4750d8c11edf87f5 Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:18:44 -0700 Subject: [PATCH 05/11] install --- .github/workflows/pull_request.yaml | 2 ++ .github/workflows/release.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index b74c1ab..9b415c5 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -39,6 +39,8 @@ jobs: run: | . $(werf ci-env github --as-file) + apt-get install -y buildah uidmap + werf cr login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} werf build diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bf90bd3..637953c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -61,6 +61,8 @@ jobs: run: | . $(werf ci-env github --as-file) + apt-get install -y buildah uidmap + werf cr login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} werf export --repo fivestarsos/aladdin ${{steps.werf-args.outputs.result}} From 6ec323e296679dd343bd8f48988f7af2f88ce571 Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:20:47 -0700 Subject: [PATCH 06/11] yuck --- .github/workflows/pull_request.yaml | 3 --- .github/workflows/release.yaml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 9b415c5..cda2d6c 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -35,12 +35,9 @@ jobs: - name: werf build env: WERF_DISABLE_AUTO_HOST_CLEANUP: "1" - WERF_BUILDAH_MODE: auto run: | . $(werf ci-env github --as-file) - apt-get install -y buildah uidmap - werf cr login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} werf build diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 637953c..78ec59d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -57,12 +57,9 @@ jobs: - name: werf publish env: WERF_DISABLE_AUTO_HOST_CLEANUP: "1" - WERF_BUILDAH_MODE: auto run: | . $(werf ci-env github --as-file) - apt-get install -y buildah uidmap - werf cr login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} werf export --repo fivestarsos/aladdin ${{steps.werf-args.outputs.result}} From 0ffc559ad1cb50c33d42e9a7645cb9b11458a61a Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:25:35 -0700 Subject: [PATCH 07/11] bookworm --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 25522a1..fb645f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10.6-bullseye as build +FROM python:3.10.16-bookworm as build WORKDIR /root/aladdin @@ -25,7 +25,7 @@ ARG VIRTUAL_ENV=/root/.venv COPY pyproject.toml poetry.lock ./ RUN poetry install --no-root --only main -FROM python:3.10.6-slim-bullseye +FROM python:3.10.16-slim-bookworm # Remove the default $PS1 manipulation RUN rm /etc/bash.bashrc From b5fabd125e8b030304181e02296adfe4da203d32 Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:30:17 -0700 Subject: [PATCH 08/11] fix docker --- Dockerfile | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index fb645f2..bd9464b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,18 +66,13 @@ RUN curl -L \ -o /usr/local/bin/aws-iam-authenticator && \ chmod 755 /usr/local/bin/aws-iam-authenticator -ARG DOCKER_VERSION=20.10.22 -RUN curl -fsSL https://get.docker.com -o /tmp/get-docker.sh && \ - VERSION=$DOCKER_VERSION sh /tmp/get-docker.sh +ARG DOCKER_VERSION=27.3.1 +RUN curl -fsSL https://get.docker.com | bash -s -- --version ${DOCKER_VERSION} -ARG DOCKER_COMPOSE_VERSION=1.29.2 -RUN curl -L "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \ +ARG DOCKER_COMPOSE_2_VERSION=v2.32.4 +RUN curl -L "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_2_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \ chmod 755 /usr/local/bin/docker-compose -ARG DOCKER_COMPOSE_2_VERSION=v2.14.2 -RUN curl -L "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_2_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose-2 && \ - chmod 755 /usr/local/bin/docker-compose-2 - ARG GITHUB_CLI_VERSION=2.57.0 RUN curl -Ls "https://github.com/cli/cli/releases/download/v$GITHUB_CLI_VERSION/gh_${GITHUB_CLI_VERSION}_linux_$(dpkg --print-architecture).tar.gz" -o github_cli.tar.gz && \ tar -xzf github_cli.tar.gz && \ From af78d5b18a4b31e0592291fe5e4c291c1c054081 Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:50:14 -0700 Subject: [PATCH 09/11] switch to ghcr.io --- .github/workflows/pull_request.yaml | 6 +++--- .github/workflows/release.yaml | 25 ++++++++++++++++++++----- aladdin/config.py | 2 +- config-example/config.json | 2 +- docs/create_aladdin_configuration.md | 2 +- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index cda2d6c..56e96ea 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -27,14 +27,14 @@ jobs: # QEMU is needed to support multi-platform builds - name: Set up QEMU uses: docker/setup-qemu-action@v3 + with: + platforms: linux/amd64, linux/arm64 - uses: werf/actions/install@v2 with: - version: v2.14.0 + version: v2.26.6 - name: werf build - env: - WERF_DISABLE_AUTO_HOST_CLEANUP: "1" run: | . $(werf ci-env github --as-file) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 78ec59d..c5cb2d2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -28,10 +28,12 @@ jobs: # QEMU is needed to support multi-platform builds - name: Set up QEMU uses: docker/setup-qemu-action@v3 + with: + platforms: linux/amd64, linux/arm64 - uses: werf/actions/install@v2 with: - version: v2.14.0 + version: v2.26.6 # this will select the right tags depending on the Github event # master branch will build the "latest" and "main" Dockerhub tags @@ -40,7 +42,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: fivestarsos/aladdin + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=branch type=ref,event=tag @@ -55,11 +57,24 @@ jobs: return tags.map((tag) => `--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${tag}`) - name: werf publish - env: - WERF_DISABLE_AUTO_HOST_CLEANUP: "1" run: | . $(werf ci-env github --as-file) werf cr login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} - werf export --repo fivestarsos/aladdin ${{steps.werf-args.outputs.result}} + werf export --repo ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} ${{ steps.werf-args.outputs.result }} + + cleanup: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Fetch all history for all tags and branches + run: git fetch --prune --unshallow + + - name: Cleanup + uses: werf/actions/cleanup@v2 + with: + version: v2.26.6 diff --git a/aladdin/config.py b/aladdin/config.py index dae7b1e..2752993 100644 --- a/aladdin/config.py +++ b/aladdin/config.py @@ -8,7 +8,7 @@ PROJECT_ROOT = pathlib.Path(__file__).parent.parent -ALADDIN_DOCKER_REPO = "fivestarsos/aladdin" +ALADDIN_DOCKER_REPO = "ghcr.io/fivestars-os/aladdin/aladdin" emitted_warnings = set() diff --git a/config-example/config.json b/config-example/config.json index b8c0e38..9ae47ae 100644 --- a/config-example/config.json +++ b/config-example/config.json @@ -1,6 +1,6 @@ { "aladdin": { - "repo": "fivestarsos/aladdin" + "repo": "ghcr.io/fivestars-os/aladdin/aladdin" }, "git": { "account": "fivestars-os" diff --git a/docs/create_aladdin_configuration.md b/docs/create_aladdin_configuration.md index 43ea33b..3df09fa 100644 --- a/docs/create_aladdin_configuration.md +++ b/docs/create_aladdin_configuration.md @@ -31,7 +31,7 @@ The config.json file in the root of your config directory will contain non clust ``` { "aladdin": { - "repo": "fivestarsos/aladdin" + "repo": "ghcr.io/fivestars-os/aladdin/aladdin" }, "git": { "account": "fivestars-os" From 4875d7868964cedf3f714e2e444e569f0e38078a Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:53:02 -0700 Subject: [PATCH 10/11] nit --- .jira | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .jira diff --git a/.jira b/.jira deleted file mode 100644 index dae3136..0000000 --- a/.jira +++ /dev/null @@ -1,4 +0,0 @@ -[project] - key = ALDN -[project "ALDN"] - id = 12702 From 50727fcc43a6d68106f501938eca385c557e36cd Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:59:30 -0700 Subject: [PATCH 11/11] version bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ce0fc60..804ee5f 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aladdin" -version = "1.29.8.11" +version = "1.29.8.12" description = "" authors = ["Fivestars "] include = [