Skip to content

Commit

Permalink
fix: install python using asdf instead of gha that is not pinned (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
leiicamundi authored Jun 11, 2024
1 parent a0964b6 commit 366ff7e
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 22 deletions.
41 changes: 20 additions & 21 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 22 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 19 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 366ff7e

Please sign in to comment.