From 94f5adf362f1132463f98b1a38bf8702e4f3aff6 Mon Sep 17 00:00:00 2001 From: "Leo J." <153937047+leiicamundi@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:17:10 +0200 Subject: [PATCH 1/5] fix: install python using asdf instead of gha that is not pinned --- .github/workflows/build-images.yml | 30 +++++++++++------------------- .github/workflows/lint.yml | 5 ++++- .tool-versions | 20 ++++++++++++++++++++ DEVELOPER.md | 15 +++++++++++++++ justfile | 19 +++++++++++++++++++ 5 files changed, 69 insertions(+), 20 deletions(-) create mode 100644 .tool-versions create mode 100644 justfile diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 4064068d..9140dd34 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -52,12 +52,8 @@ jobs: - name: Checkout uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - name: Install if required common software tooling - uses: camunda/infra-global-github-actions/common-tooling@9c73d559854bd5d1cc7d1ac1982dc526f57c9782 # main - with: - java-enabled: false - yarn-enabled: false - python-version: "3.12" + - name: Install tooling using asdf + uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3 - name: Import secrets uses: hashicorp/vault-action@d1720f055e0635fd932a1d2a48f87a666a57906c # v3.0.0 @@ -153,12 +149,8 @@ jobs: - name: Checkout uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - name: Install if required common software tooling - uses: camunda/infra-global-github-actions/common-tooling@9c73d559854bd5d1cc7d1ac1982dc526f57c9782 # main - with: - java-enabled: false - yarn-enabled: false - python-version: "3.12" + - name: Install tooling using asdf + uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3 - name: Set Keycloak Image Name id: set-keycloak-image-name @@ -240,13 +232,8 @@ jobs: - name: Checkout uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - name: Install if required common software tooling - uses: camunda/infra-global-github-actions/common-tooling@9c73d559854bd5d1cc7d1ac1982dc526f57c9782 # main - with: - java-enabled: false - yarn-enabled: false - python-version: "3.12" - python-cache: "pip" + - name: Install tooling using asdf + uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3 - name: Set Keycloak Image Name id: set-keycloak-image-name @@ -465,10 +452,15 @@ jobs: - name: Install if required common software tooling uses: camunda/infra-global-github-actions/common-tooling@9c73d559854bd5d1cc7d1ac1982dc526f57c9782 # main with: + node-enabled: false java-enabled: false yarn-enabled: false + python-enabled: false buildx-install: true + - name: Install tooling using asdf + uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3 + - name: Import secrets uses: hashicorp/vault-action@d1720f055e0635fd932a1d2a48f87a666a57906c # v3.0.0 id: secrets diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c6137a3d..ae2b51ad 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,5 +12,8 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 + + - name: Install tooling using asdf + uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3 + - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..850612dc --- /dev/null +++ b/.tool-versions @@ -0,0 +1,20 @@ +################################################################################ +# # +# Note: when adding a new tool here, also adjust the Renovate configuration # +# that mirrors some asdf plugin's logic to remove version prefixes like # +# "v". # +# # +# You have to amend the Renovate config when the asdf plugin takes 1.2.3 # +# as the version but the Docker tag/Github tag is actually v1.2.3 # +# # +################################################################################ + +# /!\ Please maintain this file sorted alphabetically. +# check it with +# diff <(sed '/^#/d; /^$/d' .tool-versions | sort) <(sed '/^#/d; /^$/d' .tool-versions) && echo ".tool-versions is sorted correctly" || echo ".tool-versions is not sorted correctly" + +just 1.27.0 + +pre-commit 3.7.1 + +python 3.12.4 diff --git a/DEVELOPER.md b/DEVELOPER.md index 03e8984c..8fbf332c 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -2,6 +2,21 @@ Welcome to the development reference for Keycloak by Camunda! This document provides guidance on setting up a basic testing environment, running unit tests, and testing changes locally. +## Requirements + +To gather all specifics versions of this project, we use: +- [asdf](https://asdf-vm.com/) version manager (see [installation](https://asdf-vm.com/guide/getting-started.html)). +- [just](https://github.com/casey/just) as a command runner + - install it using asdf: `asdf plugin add just && asdf install just` + +Then we will install all the tooling listed in the `.tool-versions` of this root project using just: +```bash +just install-tooling + +# list available recipes +just --list +``` + ## Building the Image (Development Only) Building a local image is for development purposes only. diff --git a/justfile b/justfile new file mode 100644 index 00000000..08f6a374 --- /dev/null +++ b/justfile @@ -0,0 +1,19 @@ +# this file is a recipe file for the project + +# Install all the tooling +install-tooling: asdf-install + +# Install asdf plugins +asdf-plugins: + #!/bin/sh + echo "Installing asdf plugins" + for plugin in $(awk '{print $1}' .tool-versions); do \ + asdf plugin add ${plugin} 2>&1 | (grep "already added" && exit 0); \ + done + + echo "Update all asdf plugins" + asdf plugin update --all + +# Install tools using asdf +asdf-install: asdf-plugins + asdf install From 279f1916fca58665af88eb57c690fc90b11638b4 Mon Sep 17 00:00:00 2001 From: "Leo J." <153937047+leiicamundi@users.noreply.github.com> Date: Mon, 10 Jun 2024 14:40:03 +0200 Subject: [PATCH 2/5] add missing compiling libs --- .github/workflows/build-images.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 9140dd34..abe9b0ee 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -232,6 +232,9 @@ jobs: - name: Checkout uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + - name: Install build-essentials for asdf + run: sudo apt-get install build-essential -y + - name: Install tooling using asdf uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3 From 8daf584748766bc5e0aeeb3586a491d4d23030e3 Mon Sep 17 00:00:00 2001 From: "Leo J." <153937047+leiicamundi@users.noreply.github.com> Date: Mon, 10 Jun 2024 14:56:46 +0200 Subject: [PATCH 3/5] add missing compiling libs --- .github/workflows/build-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index abe9b0ee..0397cf24 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -233,7 +233,7 @@ jobs: uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - name: Install build-essentials for asdf - run: sudo apt-get install build-essential -y + run: sudo apt-get update && sudo apt-get install build-essential -y - name: Install tooling using asdf uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3 From bec9b9842c7affddf924f7eb2f5db4df2faf2565 Mon Sep 17 00:00:00 2001 From: "Leo J." <153937047+leiicamundi@users.noreply.github.com> Date: Mon, 10 Jun 2024 17:14:52 +0200 Subject: [PATCH 4/5] add missing deps --- .github/workflows/build-images.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 0397cf24..92c1bfd0 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -233,7 +233,13 @@ jobs: uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - name: Install build-essentials for asdf - run: sudo apt-get update && sudo apt-get install build-essential -y + run: | + sudo apt-get update + + sudo apt-get install -y build-essential git libexpat1-dev libssl-dev zlib1g-dev \ + libncurses5-dev libbz2-dev liblzma-dev \ + libsqlite3-dev libffi-dev tcl-dev linux-headers-generic libgdbm-dev \ + libreadline-dev tk tk-dev - name: Install tooling using asdf uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3 From 2b8dd1e21333f1dc47cd4b340739fd10d8f94dd8 Mon Sep 17 00:00:00 2001 From: "Leo J." <153937047+leiicamundi@users.noreply.github.com> Date: Tue, 11 Jun 2024 08:22:20 +0200 Subject: [PATCH 5/5] use asdf for awscli v2 installation --- .github/workflows/build-images.yml | 2 -- .tool-versions | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 92c1bfd0..752e11f4 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -364,8 +364,6 @@ jobs: run: | : # We generate a db auth token using the aws cli because IRSA access in Keycloak might not be easy to debug. : # This token will be used in the "Test psql db connection" step, and then it will be reset for the Keycloak integration test. - python3 -m pip install awscli - : # The aws command uses the environment variables provided by the runner AWS_PG_PASSWORD="$(aws rds generate-db-auth-token --hostname ${{ env.postgres_host }} --port ${{ matrix.runner_desc.keycloak_db_port }} --region ${{ env.AWS_REGION }} --username ${{ env.postgres_user }})" echo "postgres_password=${AWS_PG_PASSWORD}" >> "$GITHUB_ENV" diff --git a/.tool-versions b/.tool-versions index 850612dc..4752b1d5 100644 --- a/.tool-versions +++ b/.tool-versions @@ -13,6 +13,8 @@ # check it with # diff <(sed '/^#/d; /^$/d' .tool-versions | sort) <(sed '/^#/d; /^$/d' .tool-versions) && echo ".tool-versions is sorted correctly" || echo ".tool-versions is not sorted correctly" +awscli 2.16.0 + just 1.27.0 pre-commit 3.7.1