Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

chore(build): source the CLI version from one file instead of five pins

Vlad Ligai67ce0913f4f8
diff --git a/.github/workflows/check-dockerfile-pins.yml b/.github/workflows/check-dockerfile-pins.yml
index c25ff6592a..af6f6fb367 100644
--- a/.github/workflows/check-dockerfile-pins.yml
+++ b/.github/workflows/check-dockerfile-pins.yml
@@ -5,24 +5,24 @@ on:
types: [opened, synchronize]
paths:
- "**/Dockerfile*"
+ - "build-versions.env"
jobs:
cli-pin:
- name: Infisical CLI pin is consistent
+ name: CLI version comes from build-versions.env
runs-on: ubuntu-latest
steps:
- name: ☁️ Checkout source
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- # Five Dockerfiles install the CLI and each carries its own pin, so they
- # drift silently. Docker has no include, so this asserts instead.
- - name: Every image pins the same CLI version
+ # Five Dockerfiles install the CLI. The version is passed as a build arg
+ # from build-versions.env so there is one place to edit; this catches a
+ # version being hardcoded back into a Dockerfile.
+ - name: No hardcoded CLI version
run: |
set -euo pipefail
- pins="$(grep -rhoE 'infisical=[0-9]+\.[0-9]+\.[0-9]+' --include='Dockerfile*' . | sort -u)"
- count="$(printf '%s\n' "$pins" | grep -c . || true)"
- if [ "$count" -ne 1 ]; then
- echo "::error::Dockerfiles disagree on the Infisical CLI pin"
- grep -rnE 'infisical=[0-9]+\.[0-9]+\.[0-9]+' --include='Dockerfile*' .
+ if grep -rnE 'infisical=[0-9]' --include='Dockerfile*' .; then
+ echo "::error::Hardcoded Infisical CLI version. Use the INFISICAL_CLI_VERSION build arg and set it in build-versions.env"
exit 1
fi
- echo "All Dockerfiles pin ${pins}"
+ grep -qE '^INFISICAL_CLI_VERSION=[0-9]+\.[0-9]+\.[0-9]+$' build-versions.env
+ echo "CLI version is sourced from build-versions.env"
diff --git a/.github/workflows/publish-fips-toolchain.yml b/.github/workflows/publish-fips-toolchain.yml
index 1f5d074773..ed3ba1e3f6 100644
--- a/.github/workflows/publish-fips-toolchain.yml
+++ b/.github/workflows/publish-fips-toolchain.yml
@@ -54,13 +54,16 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Read pinned versions
+ run: grep -E '^[A-Z_]+=' build-versions.env >> "$GITHUB_ENV"
+
- name: Compute image ref and tag
id: meta
run: |
set -euo pipefail
OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
echo "image=ghcr.io/${OWNER}/backend-fips-toolchain" >> "$GITHUB_OUTPUT"
- echo "tag=${{ hashFiles('backend/Dockerfile.fips-toolchain') }}" >> "$GITHUB_OUTPUT"
+ echo "tag=${{ hashFiles('backend/Dockerfile.fips-toolchain', 'build-versions.env') }}" >> "$GITHUB_OUTPUT"
- name: Build and push ${{ matrix.arch }}
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
@@ -70,6 +73,8 @@ jobs:
push: true
platforms: linux/${{ matrix.arch }}
tags: ${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.tag }}-${{ matrix.arch }}
+ build-args: |
+ INFISICAL_CLI_VERSION=${{ env.INFISICAL_CLI_VERSION }}
manifest:
name: Merge manifest
@@ -98,7 +103,7 @@ jobs:
set -euo pipefail
OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
IMAGE="ghcr.io/${OWNER}/backend-fips-toolchain"
- TAG="${{ hashFiles('backend/Dockerfile.fips-toolchain') }}"
+ TAG="${{ hashFiles('backend/Dockerfile.fips-toolchain', 'build-versions.env') }}"
for target in "$TAG" main; do
docker buildx imagetools create \
-t "${IMAGE}:${target}" \
diff --git a/.github/workflows/release-standalone-docker-img-postgres-offical.yml b/.github/workflows/release-standalone-docker-img-postgres-offical.yml
index 90fce3c10c..f8cffcb0bd 100644
--- a/.github/workflows/release-standalone-docker-img-postgres-offical.yml
+++ b/.github/workflows/release-standalone-docker-img-postgres-offical.yml
@@ -54,6 +54,9 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Depot CLI
uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1
+ - name: Read pinned versions
+ run: grep -E '^[A-Z_]+=' build-versions.env >> "$GITHUB_ENV"
+
- name: 📦 Build backend and push to Docker Hub
uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # Main / v1, Mar 10, 2026
with:
@@ -68,6 +71,7 @@ jobs:
platforms: linux/amd64,linux/arm64
file: Dockerfile.standalone-infisical
build-args: |
+ INFISICAL_CLI_VERSION=${{ env.INFISICAL_CLI_VERSION }}
POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }}
INFISICAL_PLATFORM_VERSION=${{ steps.extract_version.outputs.version }}
DD_GIT_REPOSITORY_URL=${{ github.server_url }}/${{ github.repository }}
@@ -152,6 +156,9 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Depot CLI
uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1
+ - name: Read pinned versions
+ run: grep -E '^[A-Z_]+=' build-versions.env >> "$GITHUB_ENV"
+
- name: 📦 Build backend and export to Docker
uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # Main / v1, Mar 10, 2026
with:
@@ -166,6 +173,7 @@ jobs:
platforms: linux/amd64,linux/arm64
file: Dockerfile.fips.standalone-infisical
build-args: |
+ INFISICAL_CLI_VERSION=${{ env.INFISICAL_CLI_VERSION }}
POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }}
INFISICAL_PLATFORM_VERSION=${{ steps.extract_version.outputs.version }}
secrets: |
diff --git a/Dockerfile.fips.standalone-infisical b/Dockerfile.fips.standalone-infisical
index 7dae0d1689..e05989ab67 100644
--- a/Dockerfile.fips.standalone-infisical
+++ b/Dockerfile.fips.standalone-infisical
@@ -3,6 +3,8 @@ ARG POSTHOG_API_KEY=posthog-api-key
ARG INTERCOM_ID=intercom-id
ARG CAPTCHA_SITE_KEY=captcha-site-key
+ARG INFISICAL_CLI_VERSION
+
FROM node:22.22.0-trixie-slim AS base
# Fixes NPM vulnerability: https://security.snyk.io/vuln/SNYK-JS-CROSSSPAWN-8303230
@@ -160,6 +162,7 @@ RUN mkdir frontend-build
FROM base AS production
# Install all required runtime packages
+ARG INFISICAL_CLI_VERSION
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
autoconf \
@@ -183,7 +186,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
smbclient \
openssh-client \
&& curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash \
- && apt-get update && apt-get install -y infisical=0.43.128 \
+ && test -n "$INFISICAL_CLI_VERSION" \
+ && apt-get update && apt-get install -y infisical="$INFISICAL_CLI_VERSION" \
# Patch CVEs in base image packages (pinned versions for reproducibility)
&& apt-get install -y --only-upgrade \
libgnutls30t64=3.8.9-3+deb13u4 \
diff --git a/Dockerfile.standalone-infisical b/Dockerfile.standalone-infisical
index 9e7938f48e..c9218b594a 100644
--- a/Dockerfile.standalone-infisical
+++ b/Dockerfile.standalone-infisical
@@ -3,6 +3,8 @@ ARG POSTHOG_API_KEY=posthog-api-key
ARG INTERCOM_ID=intercom-id
ARG CAPTCHA_SITE_KEY=captcha-site-key
+ARG INFISICAL_CLI_VERSION
+
FROM node:22.22.0-trixie-slim AS base
# Fixes NPM vulnerability: https://security.snyk.io/vuln/SNYK-JS-CROSSSPAWN-8303230
@@ -199,6 +201,7 @@ FROM base AS production
# Runtime dependencies only. The PQC OpenSSL toolchain lives in
# openssl-pqc-builder; nothing here compiles.
+ARG INFISICAL_CLI_VERSION
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
bash \
@@ -213,7 +216,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libaio1t64 \
smbclient \
&& curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash \
- && apt-get update && apt-get install -y infisical=0.43.128 \
+ && test -n "$INFISICAL_CLI_VERSION" \
+ && apt-get update && apt-get install -y infisical="$INFISICAL_CLI_VERSION" \
# Patch CVEs in base image packages (pinned versions for reproducibility)
&& apt-get install -y --only-upgrade \
libgnutls30t64=3.8.9-3+deb13u4 \
diff --git a/Makefile b/Makefile
index f1764fdbc1..c4f8fb793d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,9 @@
+# Versions pinned across multiple Dockerfiles live in one file and are exported
+# so compose can pass them as build args. Dockerfiles declare the ARG without a
+# default, so a build that misses this fails rather than installing an unpinned version.
+include build-versions.env
+export
+
build:
docker-compose -f docker-compose.yml build
diff --git a/backend/Dockerfile b/backend/Dockerfile
index c044881583..ab08fe40a7 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -1,4 +1,6 @@
# Build stage
+ARG INFISICAL_CLI_VERSION
+
FROM node:22.22.0-trixie-slim AS build
WORKDIR /app
@@ -70,6 +72,7 @@ WORKDIR /app
ENV npm_config_cache /home/node/.npm
# Only runtime dependencies — no compilation happens here
+ARG INFISICAL_CLI_VERSION
RUN apt-get update && apt-get install -y \
unixodbc \
freetds-bin \
@@ -79,7 +82,8 @@ RUN apt-get update && apt-get install -y \
bash \
git \
&& curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash \
- && apt-get update && apt-get install -y infisical=0.43.128 \
+ && test -n "$INFISICAL_CLI_VERSION" \
+ && apt-get update && apt-get install -y infisical="$INFISICAL_CLI_VERSION" \
&& rm -rf /var/lib/apt/lists/*
RUN printf "[FreeTDS]\nDescription = FreeTDS Driver\nDriver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so\nSetup = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so\nFileUsage = 1\n" > /etc/odbcinst.ini
diff --git a/backend/Dockerfile.dev b/backend/Dockerfile.dev
index 919e997880..d753cd83b4 100644
--- a/backend/Dockerfile.dev
+++ b/backend/Dockerfile.dev
@@ -1,3 +1,5 @@
+ARG INFISICAL_CLI_VERSION
+
FROM debian:trixie-slim AS oracle
RUN apt-get update && apt-get install -y unzip wget ca-certificates \
&& rm -rf /var/lib/apt/lists/*
@@ -30,6 +32,7 @@ ENV SOFTHSM2_VERSION=${SOFTHSM2_VERSION} \
SOFTHSM2_SOURCES=/tmp/softhsm2
# Install all build and runtime dependencies
+ARG INFISICAL_CLI_VERSION
RUN apt-get update && apt-get install -y \
build-essential \
autoconf \
@@ -56,7 +59,8 @@ RUN apt-get update && apt-get install -y \
opensc \
smbclient \
&& curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash \
- && apt-get update && apt-get install -y infisical=0.43.128 \
+ && test -n "$INFISICAL_CLI_VERSION" \
+ && apt-get update && apt-get install -y infisical="$INFISICAL_CLI_VERSION" \
&& rm -rf /var/lib/apt/lists/*
# Create libaio symlink for Oracle Instant Client
diff --git a/backend/Dockerfile.fips-toolchain b/backend/Dockerfile.fips-toolchain
index ed57ec5161..a9f8eb5519 100644
--- a/backend/Dockerfile.fips-toolchain
+++ b/backend/Dockerfile.fips-toolchain
@@ -20,6 +20,8 @@
# removed. Also includes OpenSSL (Apache-2.0), SoftHSM2 (BSD-2-Clause), the Infisical
# CLI, and Debian packages under their respective licenses.
+ARG INFISICAL_CLI_VERSION
+
FROM debian:trixie-slim AS oracle
RUN apt-get update && apt-get install -y unzip wget ca-certificates \
&& rm -rf /var/lib/apt/lists/*
@@ -50,6 +52,7 @@ ARG SOFTHSM2_COMMIT=369df0383d101bc8952692c2a368ac8bc887d1b4
ENV SOFTHSM2_VERSION=${SOFTHSM2_VERSION} \
SOFTHSM2_SOURCES=/tmp/softhsm2
+ARG INFISICAL_CLI_VERSION
RUN apt-get update && apt-get install -y \
build-essential \
autoconf \
@@ -75,7 +78,8 @@ RUN apt-get update && apt-get install -y \
opensc \
smbclient \
&& curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash \
- && apt-get update && apt-get install -y infisical=0.43.128 \
+ && test -n "$INFISICAL_CLI_VERSION" \
+ && apt-get update && apt-get install -y infisical="$INFISICAL_CLI_VERSION" \
&& rm -rf /var/lib/apt/lists/*
RUN ARCH=$(dpkg --print-architecture) && \
diff --git a/build-versions.env b/build-versions.env
new file mode 100644
index 0000000000..ee56a45599
--- /dev/null
+++ b/build-versions.env
@@ -0,0 +1,5 @@
+# Single source of truth for versions pinned across multiple Dockerfiles.
+# Read by the Makefile for compose builds and by CI for image builds.
+# Dockerfiles declare the ARG without a default, so a build that does not pass
+# it fails loudly rather than silently installing an unpinned version.
+INFISICAL_CLI_VERSION=0.43.128
diff --git a/docker-compose.bdd.yml b/docker-compose.bdd.yml
index ae3f8ef6bd..b9855c2302 100644
--- a/docker-compose.bdd.yml
+++ b/docker-compose.bdd.yml
@@ -41,6 +41,8 @@ services:
build:
context: ./backend
dockerfile: Dockerfile.dev
+ args:
+ INFISICAL_CLI_VERSION: ${INFISICAL_CLI_VERSION}
depends_on:
db:
condition: service_started
diff --git a/docker-compose.dev-read-replica.yml b/docker-compose.dev-read-replica.yml
index d7e95bb3cc..db80682339 100644
--- a/docker-compose.dev-read-replica.yml
+++ b/docker-compose.dev-read-replica.yml
@@ -84,6 +84,8 @@ services:
build:
context: ./backend
dockerfile: Dockerfile.dev
+ args:
+ INFISICAL_CLI_VERSION: ${INFISICAL_CLI_VERSION}
env_file: .env
environment:
- DB_CONNECTION_URI=postgres://infisical:infisical@db/infisical?sslmode=disable
@@ -96,6 +98,8 @@ services:
build:
context: ./backend
dockerfile: Dockerfile.dev
+ args:
+ INFISICAL_CLI_VERSION: ${INFISICAL_CLI_VERSION}
depends_on:
db:
condition: service_started