Skip to content

Commit d0f91da

Browse files
committed
Fix artifact name generation and improve change detection logic; update documentation for backend variable file
1 parent 3ac23a4 commit d0f91da

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

.github/workflows/opex-dashboard-deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ jobs:
200200
run: |
201201
# Create a safe artifact name from the dashboard path
202202
# Replace / and . with - to make it a valid artifact name
203-
SAFE_NAME=$(echo "${DASHBOARD_PATH}" | sed 's/[\/.:.]/-/g')
203+
SAFE_NAME=$(echo "${DASHBOARD_PATH}" | sed 's/[\/.]/-/g')
204204
ARTIFACT_NAME="tfplan-${SAFE_NAME}-${GIT_SHA}"
205205
echo "name=${ARTIFACT_NAME}" >> "$GITHUB_OUTPUT"
206206
echo "Generated artifact name: ${ARTIFACT_NAME}"
@@ -265,7 +265,7 @@ jobs:
265265
run: |
266266
# Create a safe artifact name from the dashboard path (same logic as in plan job)
267267
# Replace / and . with - to make it a valid artifact name
268-
SAFE_NAME=$(echo "${DASHBOARD_PATH}" | sed 's/[\/.:.]/-/g')
268+
SAFE_NAME=$(echo "${DASHBOARD_PATH}" | sed 's/[\/.]/-/g')
269269
ARTIFACT_NAME="tfplan-${SAFE_NAME}-${GIT_SHA}"
270270
echo "name=${ARTIFACT_NAME}" >> "$GITHUB_OUTPUT"
271271
echo "Generated artifact name: ${ARTIFACT_NAME}"

actions/opex-dashboard-generate/detect-changes.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if [[ "${BASE_REF}" =~ [^A-Za-z0-9/_^~.-] ]]; then
4848
echo "::error::BASE_REF may only contain: alphanumeric, hyphen (-), underscore (_), forward slash (/), caret (^), tilde (~), dot (.)"
4949
exit 1
5050
fi
51-
CHANGED_FILES=$(git diff --name-only HEAD "${BASE_REF}" 2>/dev/null || echo "")
51+
CHANGED_FILES=$(git diff --name-only "${BASE_REF}" HEAD 2>/dev/null || echo "")
5252

5353
echo "Changed files:"
5454
echo "${CHANGED_FILES}"
@@ -88,7 +88,7 @@ while IFS= read -r config; do
8888
SHOULD_REGENERATE=false
8989

9090
# Check if config itself was modified
91-
if echo "${CHANGED_FILES}" | grep -q "^${config}$"; then
91+
if echo "${CHANGED_FILES}" | grep -Fqx "${config}"; then
9292
echo "Config modified: ${config}"
9393
SHOULD_REGENERATE=true
9494
fi
@@ -102,11 +102,17 @@ while IFS= read -r config; do
102102
fi
103103

104104
if [ -n "${OA3_SPEC}" ]; then
105-
# Handle relative paths (relative to workspace root)
106-
if [[ "${OA3_SPEC}" != /* ]] && [[ "${OA3_SPEC}" != http* ]]; then
107-
OA3_SPEC_FULL=$(normalize_path "${OA3_SPEC}" 2>/dev/null | sed "s|^${WORKSPACE_ROOT}/||" || echo "")
105+
# Skip remote specs
106+
if [[ "${OA3_SPEC}" != http* ]]; then
107+
if [[ "${OA3_SPEC}" = /* ]]; then
108+
# Treat absolute repo paths as workspace-root relative by stripping leading slash
109+
OA3_SPEC_FULL="${OA3_SPEC#/}"
110+
else
111+
# Handle relative paths (relative to workspace root)
112+
OA3_SPEC_FULL=$(normalize_path "${OA3_SPEC}" 2>/dev/null | sed "s|^${WORKSPACE_ROOT}/||" || echo "")
113+
fi
108114

109-
if [ -n "${OA3_SPEC_FULL}" ] && echo "${CHANGED_FILES}" | grep -q "^${OA3_SPEC_FULL}$"; then
115+
if [ -n "${OA3_SPEC_FULL}" ] && echo "${CHANGED_FILES}" | grep -Fqx "${OA3_SPEC_FULL}"; then
110116
echo "OpenAPI spec modified: ${OA3_SPEC_FULL} (referenced by ${config})"
111117
SHOULD_REGENERATE=true
112118
fi

actions/opex-dashboard-generate/extract-directories.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ CHANGED_TF_FILES=$(git status --porcelain -- '*.tf' \
2626
| sed -E 's/.* -> //' || echo "")
2727

2828
if [ -z "${CHANGED_TF_FILES}" ]; then
29-
echo "has_changes=true" >> "${GITHUB_OUTPUT}"
29+
echo "has_changes=false" >> "${GITHUB_OUTPUT}"
3030
echo "changed_directories=[]" >> "${GITHUB_OUTPUT}"
3131
echo "No Terraform files generated (but other files changed)"
3232
exit 0

apps/website/docs/pipelines/opex-dashboard.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ paths. Each config directory should contain (or will receive):
219219
.opex/path/to/dashboard/
220220
├── config.yaml # Dashboard configuration
221221
├── backend.tf # Terraform backend (auto-generated by opex-dashboard or manually created)
222+
├── backend.tfvars # Backend variable values (required for terraform init)
222223
├── opex.tf # Generated dashboard Terraform (auto-generated)
223224
├── boilerplate.tf # Provider config (auto-generated)
224225
├── variables.tf # Variable declarations (auto-generated)

0 commit comments

Comments
 (0)