Skip to content

Commit 4ef5cd9

Browse files
Merge branch 'main' of github.com:redhat-developer/rhdh into feat/company-logo
2 parents 9204d9f + 68982c1 commit 4ef5cd9

File tree

261 files changed

+8758
-9367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+8758
-9367
lines changed

.github/actions/check-image-and-changes/action.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ outputs:
88
relevant_changes:
99
description: "True if changes require a build"
1010
value: ${{ steps.changes.outputs.relevant }}
11+
is_skipped:
12+
description: "True if build should be skipped (via [skip-build] tag OR image exists with no relevant changes)"
13+
value: ${{ steps.final-decision.outputs.is_skipped }}
1114
short_sha:
1215
description: "Short SHA of the latest commit"
1316
value: ${{ env.SHORT_SHA }}
@@ -35,6 +38,14 @@ runs:
3538
echo "Changed files:"
3639
echo "$CHANGED_FILES"
3740
41+
# Check for [skip-build] tag in commit messages
42+
SKIP_BUILD_TAG=false
43+
COMMIT_MESSAGES=$(git log --format=%B "$BASE_COMMIT"..HEAD)
44+
if echo "$COMMIT_MESSAGES" | grep -q "\[skip-build\]"; then
45+
echo "Found [skip-build] tag in commit messages."
46+
SKIP_BUILD_TAG=true
47+
fi
48+
3849
# Flag to track if we found any relevant changes
3950
RELEVANT_CHANGES=false
4051
@@ -59,6 +70,10 @@ runs:
5970
echo "relevant=false" >> $GITHUB_OUTPUT
6071
fi
6172
73+
# Set is_skipped flag for now (will be updated after image check)
74+
echo "skip_build_tag=$SKIP_BUILD_TAG" >> $GITHUB_OUTPUT
75+
echo "relevant_changes=$RELEVANT_CHANGES" >> $GITHUB_OUTPUT
76+
6277
- name: Check if Docker image exists
6378
id: image-check
6479
shell: bash
@@ -86,3 +101,28 @@ runs:
86101
echo "Image does not exist (checked both $IMAGE_NAME_PR and $IMAGE_NAME_COMMIT)."
87102
echo "exists=false" >> $GITHUB_OUTPUT
88103
fi
104+
105+
- name: Determine final skip decision
106+
id: final-decision
107+
shell: bash
108+
run: |
109+
# Get the values from previous steps
110+
SKIP_BUILD_TAG="${{ steps.changes.outputs.skip_build_tag }}"
111+
RELEVANT_CHANGES="${{ steps.changes.outputs.relevant_changes }}"
112+
IMAGE_EXISTS="${{ steps.image-check.outputs.exists }}"
113+
114+
echo "Skip build tag: $SKIP_BUILD_TAG"
115+
echo "Relevant changes: $RELEVANT_CHANGES"
116+
echo "Image exists: $IMAGE_EXISTS"
117+
118+
# Simplified logic: Skip if [skip-build] tag OR (image exists AND no relevant changes)
119+
if [[ "$SKIP_BUILD_TAG" == "true" ]]; then
120+
echo "Build will be skipped due to [skip-build] tag."
121+
echo "is_skipped=true" >> $GITHUB_OUTPUT
122+
elif [[ "$IMAGE_EXISTS" == "true" && "$RELEVANT_CHANGES" == "false" ]]; then
123+
echo "Build will be skipped - image exists and no relevant changes detected."
124+
echo "is_skipped=true" >> $GITHUB_OUTPUT
125+
else
126+
echo "Build will proceed - either no existing image or relevant changes detected."
127+
echo "is_skipped=false" >> $GITHUB_OUTPUT
128+
fi

.github/workflows/pr-build-image.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,8 @@ jobs:
5656
echo "Base Tag: pr-${{ github.event.number }}"
5757
echo "Commit Tag: pr-${{ github.event.number }}-${{ env.SHORT_SHA }}"
5858
59-
- name: Check if build should be skipped
60-
run: |
61-
if [[ "${{ steps.check-image.outputs.relevant_changes }}" == "false" && "${{ steps.check-image.outputs.image_exists }}" == "true" ]]; then
62-
echo "::notice::Skipping build: Image already exists and no relevant changes detected."
63-
exit 0
64-
fi
65-
6659
- name: Get the latest commits from base branch
60+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
6761
run: |
6862
git remote add base-origin https://github.com/${{ github.repository }} || true
6963
git config user.name "${{ github.event.pull_request.user.login }}"
@@ -73,7 +67,7 @@ jobs:
7367
git merge --no-edit base-origin/${{ github.event.pull_request.base.ref }}
7468
7569
- name: Build and Push with Buildx
76-
if: ${{ steps.check-image.outputs.relevant_changes == 'true' || steps.check-image.outputs.image_exists == 'false' }}
70+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
7771
uses: ./.github/actions/docker-build
7872
with:
7973
registry: ${{ env.REGISTRY }}
@@ -88,6 +82,7 @@ jobs:
8882
platform: linux/amd64
8983

9084
- name: Comment the image pull link
85+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
9186
uses: actions/github-script@v7
9287
with:
9388
script: |

.github/workflows/pr.yaml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,35 @@ jobs:
3737
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
3838
with:
3939
fetch-depth: 0
40+
ref: ${{ github.event.pull_request.head.sha }}
4041

4142
- name: Check Image and Relevant Changes
4243
id: check-image
4344
uses: ./.github/actions/check-image-and-changes
4445

45-
- name: Check if build should be skipped
46-
run: |
47-
if [[ "${{ steps.check-image.outputs.relevant_changes }}" == "false" && "${{ steps.check-image.outputs.image_exists }}" == "true" ]]; then
48-
echo "Skipping build: Image already exists and no relevant changes detected."
49-
exit 0
50-
fi
51-
5246
- name: Setup Node.js
47+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
5348
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
5449
with:
5550
node-version: ${{ matrix.node-version }}
5651
registry-url: "https://registry.npmjs.org"
5752

5853
- name: Setup local Turbo cache
54+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
5955
uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1
6056

6157
- name: Use app-config.example.yaml
58+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
6259
run: rm app-config.yaml && mv app-config.example.yaml app-config.yaml
6360

6461
- name: Install dependencies
62+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
6563
uses: backstage/actions/yarn-install@b3c1841fd69e1658ac631afafd0fb140a2309024 # v0.6.17
6664
with:
6765
cache-prefix: ${{ runner.os }}-v${{ matrix.node-version }}
6866

6967
- name: Build packages
68+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
7069
run: yarn run build --continue --affected
7170

7271
test:
@@ -80,55 +79,60 @@ jobs:
8079
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
8180
with:
8281
fetch-depth: 0
82+
ref: ${{ github.event.pull_request.head.sha }}
8383

8484
- name: Check Image and Relevant Changes
8585
id: check-image
8686
uses: ./.github/actions/check-image-and-changes
8787

88-
- name: Check if tests should be skipped
89-
run: |
90-
if [[ "${{ steps.check-image.outputs.relevant_changes }}" == "false" && "${{ steps.check-image.outputs.image_exists }}" == "true" ]]; then
91-
echo "Skipping tests: No relevant changes detected."
92-
exit 0
93-
fi
94-
9588
- name: Setup Node.js
89+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
9690
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
9791
with:
9892
node-version: ${{ matrix.node-version }}
9993
registry-url: "https://registry.npmjs.org"
10094

10195
- name: Setup local Turbo cache
96+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
10297
uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1
10398

10499
- name: Use app-config.example.yaml
100+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
105101
run: rm app-config.yaml && mv app-config.example.yaml app-config.yaml
106102

107103
- name: Install dependencies
104+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
108105
uses: backstage/actions/yarn-install@b3c1841fd69e1658ac631afafd0fb140a2309024 # v0.6.17
109106
with:
110107
cache-prefix: ${{ runner.os }}-v${{ matrix.node-version }}
111108

112109
- name: Run prettier
110+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
113111
run: yarn prettier:check --continue --affected
114112

115113
- name: Run lint
114+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
116115
run: yarn run lint:check --continue --affected
117116

118117
- name: Run monorepo tools
118+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
119119
run: yarn run monorepo:check
120120

121121
- name: Regenerate dockerfiles
122+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
122123
run: |
123124
yarn run build:dockerfile; if [[ $(git diff --name-only | grep Dockerfile || true) != "" ]]; then \
124125
echo "ERROR: Workspace is dirty! Must run 'yarn build:dockerfile' and commit changes!"; exit 1; \
125126
fi
126127
127128
- name: Run tests
129+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
128130
run: yarn run test --continue --affected
129131

130132
- name: Install dynamic plugin dependencies
133+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
131134
run: cd ./dynamic-plugins && yarn install && cd ..
132135

133136
- name: Verify dynamic plugin wrappers
137+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
134138
run: cd ./dynamic-plugins && yarn test && cd ..
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Update versions.md in Dynamic Plugins Documentation
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- "backstage.json"
8+
- "packages/app/package.json"
9+
- "packages/backend/package.json"
10+
11+
jobs:
12+
update-versions-md:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Generate token
16+
id: generate-token
17+
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0
18+
with:
19+
app-id: ${{ secrets.RHDH_GITHUB_APP_ID }}
20+
private-key: ${{ secrets.RHDH_GITHUB_APP_PRIVATE_KEY }}
21+
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version-file: ".nvmrc"
29+
30+
- name: Run update-versions-doc script
31+
run: node scripts/update-versions-doc.mjs docs/dynamic-plugins/versions.md
32+
env:
33+
GITHUB_REPOSITORY: ${{ github.repository }}
34+
35+
- name: Create Pull Request
36+
uses: peter-evans/create-pull-request@v7
37+
with:
38+
token: ${{ steps.generate-token.outputs.token }}
39+
commit-message: "chore(docs): Update versions.md in dynamic plugin documentation"
40+
branch: update-versions-doc-${{ github.ref_name }}
41+
title: "chore(docs): [${{ github.ref_name }}] Update versions.md in dynamic plugin documentation"
42+
body: "Updates Version Compatibility Matrix in dynamic plugin documentation"
43+
labels: "documentation"
44+
signoff: true
45+
delete-branch: true

.ibm/images/Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Base image from Microsoft Playwright
22
# Must stay pinned to a version which includes Nodejs 22
3-
FROM mcr.microsoft.com/playwright:v1.52.0-jammy
3+
FROM mcr.microsoft.com/playwright:v1.53.0-jammy
44

55
# Set environment variables for the container
66
ENV CI=1 \
@@ -77,6 +77,11 @@ RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.
7777
RUN apt-get update -y && \
7878
apt-get install -y skopeo
7979

80+
# Install PostgreSQL CLI (psql only)
81+
RUN apt-get update && \
82+
apt-get install -y --no-install-recommends postgresql-client && \
83+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
84+
8085
# Install umoci
8186
RUN curl -LO "https://github.com/opencontainers/umoci/releases/download/v0.4.7/umoci.amd64" && \
8287
chmod +x umoci.amd64 && \

.ibm/pipelines/clear-database.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
clear_database() {
4+
export POSTGRES_USER="$(echo -n "$RDS_USER" | base64 --decode)"
5+
export PGPASSWORD=$RDS_PASSWORD
6+
export POSTGRES_HOST=$RDS_1_HOST
7+
8+
echo "Starting database cleanup process..."
9+
10+
# Get list of databases, handle potential connection errors
11+
DATABASES=$(psql -h "$POSTGRES_HOST" -U "$POSTGRES_USER" -p "5432" -d postgres -Atc \
12+
"SELECT datname FROM pg_database WHERE datistemplate = false AND datname NOT IN ('postgres', 'rdsadmin');" 2>/dev/null)
13+
14+
if [ $? -ne 0 ]; then
15+
echo "Warning: Failed to connect to database or retrieve database list"
16+
return 1
17+
fi
18+
19+
if [ -z "$DATABASES" ]; then
20+
echo "No databases found to drop"
21+
return 0
22+
fi
23+
24+
echo "Found databases to drop: $(echo "$DATABASES" | tr '\n' ' ')"
25+
26+
for db in $DATABASES; do
27+
echo "Attempting to drop database: $db"
28+
29+
# Use IF EXISTS to avoid errors if database doesn't exist
30+
# Capture both stdout and stderr, but don't let errors stop the script
31+
if psql -h "$POSTGRES_HOST" -U "$POSTGRES_USER" -p "5432" -d postgres -c "DROP DATABASE IF EXISTS \"$db\";" 2>&1; then
32+
echo "Successfully dropped database: $db"
33+
else
34+
echo "Warning: Failed to drop database $db, but continuing with cleanup"
35+
fi
36+
done
37+
38+
echo "Database cleanup process completed"
39+
}

.ibm/pipelines/cluster/aks/aks-helm-deployment.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ initiate_aks_helm_deployment() {
1717
cp -a "/tmp/${HELM_CHART_K8S_MERGED_VALUE_FILE_NAME}" "${ARTIFACT_DIR}/${NAME_SPACE}/" # Save the final value-file into the artifacts directory.
1818
echo "Deploying image from repository: ${QUAY_REPO}, TAG_NAME: ${TAG_NAME}, in NAME_SPACE: ${NAME_SPACE}"
1919
helm upgrade -i "${RELEASE_NAME}" -n "${NAME_SPACE}" \
20-
"${HELM_REPO_NAME}/${HELM_IMAGE_NAME}" --version "${CHART_VERSION}" \
20+
"${HELM_CHART_URL}" --version "${CHART_VERSION}" \
2121
-f "/tmp/${HELM_CHART_K8S_MERGED_VALUE_FILE_NAME}" \
2222
--set global.host="${K8S_CLUSTER_ROUTER_BASE}" \
2323
--set upstream.backstage.image.repository="${QUAY_REPO}" \

.ibm/pipelines/cluster/gke/gke-helm-deployment.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ initiate_gke_helm_deployment() {
2121
cp -a "/tmp/${HELM_CHART_K8S_MERGED_VALUE_FILE_NAME}" "${ARTIFACT_DIR}/${NAME_SPACE}/" # Save the final value-file into the artifacts directory.
2222
echo "Deploying image from repository: ${QUAY_REPO}, TAG_NAME: ${TAG_NAME}, in NAME_SPACE: ${NAME_SPACE}"
2323
helm upgrade -i "${RELEASE_NAME}" -n "${NAME_SPACE}" \
24-
"${HELM_REPO_NAME}/${HELM_IMAGE_NAME}" --version "${CHART_VERSION}" \
24+
"${HELM_CHART_URL}" --version "${CHART_VERSION}" \
2525
-f "/tmp/${HELM_CHART_K8S_MERGED_VALUE_FILE_NAME}" \
2626
--set global.host="${K8S_CLUSTER_ROUTER_BASE}" \
2727
--set upstream.backstage.image.repository="${QUAY_REPO}" \

0 commit comments

Comments
 (0)