diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 4064068d..752e11f4 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,17 @@ 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 build-essentials for asdf + 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 - name: Set Keycloak Image Name id: set-keycloak-image-name @@ -368,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" @@ -465,10 +459,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..4752b1d5 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,22 @@ +################################################################################ +# # +# 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" + +awscli 2.16.0 + +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