From 6598ce5d3a712169660562b7122e2f81cc073bb5 Mon Sep 17 00:00:00 2001 From: Stephan D Date: Fri, 7 Nov 2025 20:37:46 +0100 Subject: [PATCH] build fix --- .woodpecker/fx.yml | 2 +- ci/pipelines/fx/ensure_env_version.sh | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.woodpecker/fx.yml b/.woodpecker/fx.yml index a58f892..eb45e34 100644 --- a/.woodpecker/fx.yml +++ b/.woodpecker/fx.yml @@ -54,7 +54,7 @@ steps: depends_on: [ secrets ] commands: - set -euo pipefail 2>/dev/null || set -eu - - bash ci/pipelines/fx/ensure_env_version.sh + - sh ci/pipelines/fx/ensure_env_version.sh - sed -i 's/\r$//' ./ci/prod/.env.runtime - sed -i 's/\r$//' ./.env.version - set -a diff --git a/ci/pipelines/fx/ensure_env_version.sh b/ci/pipelines/fx/ensure_env_version.sh index bad125d..ae2c71a 100755 --- a/ci/pipelines/fx/ensure_env_version.sh +++ b/ci/pipelines/fx/ensure_env_version.sh @@ -1,10 +1,10 @@ -#!/usr/bin/env bash -set -euo pipefail +#!/bin/sh +set -eu regen_env_version() { echo "[fx-pipeline] regenerating .env.version defaults" >&2 - local git_rev branch app_v build_date build_user - if [[ -n "${WOODPECKER_COMMIT:-}" ]]; then + + if [ -n "${WOODPECKER_COMMIT:-}" ]; then git_rev="$(printf '%s' "${WOODPECKER_COMMIT}" | cut -c1-7)" elif command -v git >/dev/null 2>&1; then git_rev="$(git rev-parse --short HEAD 2>/dev/null || echo dev)" @@ -12,7 +12,7 @@ regen_env_version() { git_rev="dev" fi - if [[ -n "${WOODPECKER_BRANCH:-}" ]]; then + if [ -n "${WOODPECKER_BRANCH:-}" ]; then branch="${WOODPECKER_BRANCH}" elif command -v git >/dev/null 2>&1; then branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo local)" @@ -20,7 +20,7 @@ regen_env_version() { branch="local" fi - if [[ -f version ]]; then + if [ -f version ]; then app_v="$(cat version 2>/dev/null || echo dev)" else app_v="dev" @@ -34,12 +34,11 @@ regen_env_version() { } ensure_env_version() { - if [[ ! -s ./.env.version ]]; then + if [ ! -s ./.env.version ]; then regen_env_version return fi - local tmp tmp="$(mktemp)" if ! grep -E '^[[:space:]]*[A-Za-z_][A-Za-z0-9_]*=' ./.env.version >"$tmp"; then rm -f "$tmp" @@ -47,7 +46,7 @@ ensure_env_version() { return fi - if [[ ! -s "$tmp" ]]; then + if [ ! -s "$tmp" ]; then rm -f "$tmp" regen_env_version return