Skip to content

Commit 64286ff

Browse files
authored
Merge branch 'main' into chore_411
2 parents 4c39564 + c9e5320 commit 64286ff

File tree

154 files changed

+5564
-1256
lines changed

Some content is hidden

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

154 files changed

+5564
-1256
lines changed

.github/scripts/manifest-utils.js

Lines changed: 57 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,65 +29,98 @@ async function getLatestCommitSha(github, org, repo, ref) {
2929
}
3030

3131
/**
32-
* Parse the get_all_manifests.sh file to extract component definitions
33-
* @param {string} filePath - Path to the manifest file
34-
* @returns {Map} Map of component name to component info
32+
* Parse a manifest block from the content
33+
* @param {string} content - Full file content
34+
* @param {string} arrayName - Name of the array to extract (e.g., 'ODH_COMPONENT_MANIFESTS')
35+
* @param {string} platform - Platform identifier ('odh' or 'rhoai')
36+
* @returns {Array} Array of component info objects
3537
*/
36-
function parseManifestFile(filePath) {
37-
const content = fs.readFileSync(filePath, 'utf8');
38-
const components = new Map();
38+
function parseManifestBlock(content, arrayName, platform) {
39+
const components = [];
40+
41+
// Extract the entire manifest block using regex
42+
const blockRegex = new RegExp(
43+
`declare -A ${arrayName}=\\(([\\s\\S]*?)\\n\\)`,
44+
'm'
45+
);
46+
const blockMatch = content.match(blockRegex);
47+
48+
if (!blockMatch) {
49+
return components;
50+
}
51+
52+
const blockContent = blockMatch[1];
3953

4054
// Regex to match component manifest definitions (line by line)
4155
// Pattern: ["component"]="org:repo:ref:path"
42-
const manifestRegex = /^\s*\["([^"]+)"\]="([^:]+):([^:]+):([^:]+):([^"]+)"$/;
43-
44-
const lines = content.split('\n');
45-
for (const line of lines) {
46-
const match = line.match(manifestRegex);
47-
if (!match) {
48-
continue;
49-
}
56+
const manifestRegex = /\["([^"]+)"\]="([^:]+):([^:]+):([^:]+):([^"]+)"/g;
5057

58+
let match;
59+
while ((match = manifestRegex.exec(blockContent)) !== null) {
5160
const [fullMatch, componentName, org, repo, ref, sourcePath] = match;
5261

53-
components.set(componentName, {
62+
components.push({
63+
componentName,
5464
org,
5565
repo,
5666
ref,
5767
sourcePath,
58-
originalLine: fullMatch.trim()
68+
originalLine: fullMatch.trim(),
69+
platform
5970
});
6071
}
6172

6273
return components;
6374
}
6475

76+
/**
77+
* Parse the get_all_manifests.sh file to extract component definitions
78+
* Now supports both ODH and RHOAI platform types
79+
* @param {string} filePath - Path to the manifest file
80+
* @returns {object} Object containing:
81+
* - odh: Array of component info for ODH
82+
* - rhoai: Array of component info for RHOAI
83+
*/
84+
function parseManifestFile(filePath) {
85+
const content = fs.readFileSync(filePath, 'utf8');
86+
87+
// Parse both ODH and RHOAI manifest blocks
88+
const odhComponents = parseManifestBlock(content, 'ODH_COMPONENT_MANIFESTS', 'odh');
89+
const rhoaiComponents = parseManifestBlock(content, 'RHOAI_COMPONENT_MANIFESTS', 'rhoai');
90+
91+
return {
92+
odh: odhComponents,
93+
rhoai: rhoaiComponents
94+
};
95+
}
96+
6597
/**
6698
* Update the manifest file with new component information
6799
* @param {string} filePath - Path to the manifest file
68-
* @param {Map} updates - Map of component name to update info
100+
* @param {Array} updates - Array of update objects containing componentName and update info
69101
*/
70102
function updateManifestFile(filePath, updates) {
71-
if (updates.size === 0) {
103+
if (!updates || updates.length === 0) {
72104
console.log('No updates to apply');
73105
return false;
74106
}
75107

76108
let content = fs.readFileSync(filePath, 'utf8');
77109
let hasChanges = false;
78110

79-
for (const [componentName, updateInfo] of updates) {
80-
const oldLine = updateInfo.originalLine;
81-
const newLine = `["${componentName}"]="${updateInfo.org}:${updateInfo.repo}:${updateInfo.newRef}:${updateInfo.sourcePath}"`;
111+
for (const update of updates) {
112+
const { componentName, org, repo, newRef, sourcePath, originalLine, logMessage } = update;
113+
const oldLine = originalLine;
114+
const newLine = `["${componentName}"]="${org}:${repo}:${newRef}:${sourcePath}"`;
82115

83116
if (content.includes(oldLine)) {
84117
content = content.replace(oldLine, newLine);
85118
hasChanges = true;
86-
if (updateInfo.logMessage) {
87-
console.log(updateInfo.logMessage);
119+
if (logMessage) {
120+
console.log(logMessage);
88121
}
89122
} else {
90-
console.log(`Warning: Could not find ${componentName} in manifest file`);
123+
console.log(`Warning: Could not find component in manifest file (originalLine: ${oldLine})`);
91124
}
92125
}
93126

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,66 @@
11
const { getLatestCommitSha, parseManifestFile, updateManifestFile } = require('./manifest-utils');
22

33
module.exports = async function ({ github, core }) {
4-
54
const manifestFile = 'get_all_manifests.sh';
6-
const allComponents = parseManifestFile(manifestFile);
7-
8-
// Filter to only components with branch@sha format
9-
const componentsWithSha = new Map();
10-
for (const [componentName, componentInfo] of allComponents) {
11-
if (!componentInfo.ref.includes('@')) {
12-
continue;
13-
}
14-
15-
const refParts = componentInfo.ref.split('@');
16-
if (refParts.length !== 2) {
17-
console.log(`⚠️ Skipping ${componentName}: invalid ref format "${componentInfo.ref}" (expected "branch@sha")`);
18-
continue;
19-
}
20-
21-
const [branchRef, commitSha] = refParts;
22-
if (!branchRef || !commitSha) {
23-
console.log(`⚠️ Skipping ${componentName}: empty branch or SHA in ref "${componentInfo.ref}"`);
24-
continue;
5+
const parsedManifests = parseManifestFile(manifestFile);
6+
7+
const updates = [];
8+
9+
// Process both ODH and RHOAI platforms
10+
for (const components of [parsedManifests.odh, parsedManifests.rhoai]) {
11+
// Filter to only components with branch@sha format
12+
const componentsWithSha = [];
13+
for (const componentInfo of components) {
14+
if (!componentInfo.ref.includes('@')) {
15+
continue;
16+
}
17+
18+
const refParts = componentInfo.ref.split('@');
19+
if (refParts.length !== 2) {
20+
console.log(`⚠️ Skipping ${componentInfo.platform}:${componentInfo.componentName}: invalid ref format "${componentInfo.ref}" (expected "branch@sha")`);
21+
continue;
22+
}
23+
24+
const [branchRef, commitSha] = refParts;
25+
if (!branchRef || !commitSha) {
26+
console.log(`⚠️ Skipping ${componentInfo.platform}:${componentInfo.componentName}: empty branch or SHA in ref "${componentInfo.ref}"`);
27+
continue;
28+
}
29+
30+
componentsWithSha.push({
31+
...componentInfo,
32+
branchRef,
33+
commitSha
34+
});
2535
}
2636

27-
componentsWithSha.set(componentName, {
28-
...componentInfo,
29-
branchRef,
30-
commitSha
31-
});
32-
}
33-
34-
console.log(`Found ${componentsWithSha.size} components with branch@sha format`);
37+
console.log(`Found ${componentsWithSha.length} ${componentsWithSha.length > 0 ? componentsWithSha[0].platform.toUpperCase() : ''} components with branch@sha format`);
3538

36-
const updates = new Map();
39+
for (const manifest of componentsWithSha) {
40+
console.log(`Checking ${manifest.platform}:${manifest.componentName} (${manifest.org}/${manifest.repo}:${manifest.branchRef})...`);
3741

38-
for (const [componentName, manifest] of componentsWithSha) {
39-
console.log(`Checking ${componentName} (${manifest.org}/${manifest.repo}:${manifest.branchRef})...`);
42+
const latestSha = await getLatestCommitSha(github, manifest.org, manifest.repo, manifest.branchRef);
4043

41-
const latestSha = await getLatestCommitSha(github, manifest.org, manifest.repo, manifest.branchRef);
44+
if (latestSha && latestSha !== manifest.commitSha) {
45+
console.log(`Update needed for ${manifest.platform}:${manifest.componentName}: ${manifest.commitSha.substring(0, 8)}${latestSha.substring(0, 8)}`);
4246

43-
if (latestSha && latestSha !== manifest.commitSha) {
44-
console.log(`Update needed for ${componentName}: ${manifest.commitSha.substring(0, 8)}${latestSha.substring(0, 8)}`);
45-
46-
updates.set(componentName, {
47-
org: manifest.org,
48-
repo: manifest.repo,
49-
newRef: `${manifest.branchRef}@${latestSha}`,
50-
sourcePath: manifest.sourcePath,
51-
originalLine: manifest.originalLine,
52-
logMessage: `✅ Updated ${componentName}: ${manifest.commitSha.substring(0, 8)}${latestSha.substring(0, 8)}`
53-
});
54-
} else {
55-
console.log(`No update needed for ${componentName}`);
47+
updates.push({
48+
componentName: manifest.componentName,
49+
org: manifest.org,
50+
repo: manifest.repo,
51+
newRef: `${manifest.branchRef}@${latestSha}`,
52+
sourcePath: manifest.sourcePath,
53+
originalLine: manifest.originalLine,
54+
logMessage: `✅ Updated ${manifest.platform}:${manifest.componentName}: ${manifest.commitSha.substring(0, 8)}${latestSha.substring(0, 8)}`
55+
});
56+
} else {
57+
console.log(`No update needed for ${manifest.platform}:${manifest.componentName}`);
58+
}
5659
}
5760
}
5861

5962
// Set outputs
60-
const hasUpdates = updates.size > 0;
63+
const hasUpdates = updates.length > 0;
6164
core.setOutput('updates-needed', hasUpdates);
6265

6366
if (!hasUpdates) {
@@ -69,5 +72,5 @@ module.exports = async function ({ github, core }) {
6972
console.log('Updating manifest file...');
7073
updateManifestFile(manifestFile, updates);
7174

72-
console.log(`Successfully processed ${updates.size} manifest updates`);
75+
console.log(`Successfully processed ${updates.length} manifest updates`);
7376
}

.github/scripts/update-manifests-tags.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ const { parseManifestFile, updateManifestFile } = require('./manifest-utils');
88
module.exports = () => {
99
const manifestFile = 'get_all_manifests.sh';
1010

11-
console.log('Updating component branches/tags...');
11+
console.log('Updating component branches/tags for ODH...');
1212

13-
const manifestComponents = parseManifestFile(manifestFile);
13+
const parsedManifests = parseManifestFile(manifestFile);
14+
15+
// Only process ODH components for this script
16+
const manifestComponents = parsedManifests.odh;
1417

1518
const specPrefix = 'component_spec_';
1619

17-
const updates = new Map();
20+
const updates = [];
1821

1922
for (const [key, value] of Object.entries(process.env)) {
2023
if (!key.startsWith(specPrefix)) {
@@ -30,31 +33,32 @@ module.exports = () => {
3033
const newRef = shaValue ? `${value}@${shaValue}` : value;
3134

3235
let found = false;
33-
for (const [manifestComponentName, componentInfo] of manifestComponents) {
36+
for (const componentInfo of manifestComponents) {
3437
// Normalize both to dashes for comparison
3538
// get-release-branches.js uses: "/" -> "-", so we normalize everything to "-"
36-
const normalizedManifest = manifestComponentName.toLowerCase().replace(/[\/\-_]/g, '-');
39+
const normalizedManifest = componentInfo.componentName.toLowerCase().replace(/[\/\-_]/g, '-');
3740
const normalizedKey = componentKey.toLowerCase().replace(/[\/\-_]/g, '-');
3841

3942
// Also try without workbenches prefix for special notebook-controller case
40-
const normalizedManifestWithoutPrefix = manifestComponentName.toLowerCase()
43+
const normalizedManifestWithoutPrefix = componentInfo.componentName.toLowerCase()
4144
.replace(/^workbenches[\/\-]/, '')
4245
.replace(/[\/\-_]/g, '-');
4346

4447
if (normalizedManifest === normalizedKey ||
4548
normalizedManifestWithoutPrefix === normalizedKey) {
4649
const displayRef = shaValue ? `${value}@${shaValue.substring(0, 8)}` : value;
4750

48-
updates.set(manifestComponentName, {
51+
updates.push({
52+
componentName: componentInfo.componentName,
4953
org: orgValue || componentInfo.org,
5054
repo: componentInfo.repo,
5155
newRef: newRef,
5256
sourcePath: componentInfo.sourcePath,
5357
originalLine: componentInfo.originalLine,
54-
logMessage: `Updated ${manifestComponentName} to ${displayRef}`
58+
logMessage: `Updated ${componentInfo.platform}:${componentInfo.componentName} to ${displayRef}`
5559
});
5660

57-
console.log(` Updating ${manifestComponentName} to: ${displayRef}`);
61+
console.log(` Updating ${componentInfo.platform}:${componentInfo.componentName} to: ${displayRef}`);
5862
found = true;
5963
break;
6064
}

.github/scripts/update-versions.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ set -euo
44

55
NEW_VERSION=$1
66

7-
CURRENT_VERSION=$(cat Makefile | grep -w "VERSION ?=" | cut -d ' ' -f 3)
87
CSV_FILE=config/manifests/bases/opendatahub-operator.clusterserviceversion.yaml
9-
sed -i -e "s/^VERSION ?=.*/VERSION ?= $NEW_VERSION/g" Makefile
8+
# Only update the main VERSION variable inside the ifeq block, not other VERSION variables
9+
sed -i -e "/^ifeq.*VERSION/,/^endif/{s/[[:space:]]*VERSION = .*/\tVERSION = $NEW_VERSION/;}" Makefile
1010
sed -i -e "s|containerImage.*|containerImage: quay.io/opendatahub/opendatahub-operator:v$NEW_VERSION|g" $CSV_FILE
1111
sed -i -e "s|createdAt.*|createdAt: \"$(date +"%Y-%-m-%dT00:00:00Z")\"|g" $CSV_FILE
1212
sed -i -e "s|name: opendatahub-operator.v.*|name: opendatahub-operator.v$NEW_VERSION|g" $CSV_FILE
13-
sed -i -e "s|version: $CURRENT_VERSION.*|version: $NEW_VERSION|g" $CSV_FILE
13+
sed -i -e "s|version: [0-9][0-9.]*|version: $NEW_VERSION|g" $CSV_FILE

.github/workflows/ci-build-push-e2e-tests.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,35 @@ jobs:
3535
with:
3636
go-version-file: go.mod
3737

38-
- name: Generate image tag
38+
- name: Retrieve branch name
39+
id: branch-name
40+
uses: tj-actions/branch-names@5250492686b253f06fa55861556d1027b067aeb5
41+
42+
- name: Generate image tags
3943
id: image-tag
4044
run: |
4145
# tag based on shortened commit SHA
4246
COMMIT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
43-
echo "E2E_IMAGE_TAG=main-${COMMIT_SHA}" >> $GITHUB_OUTPUT
47+
BRANCH_NAME=$(echo ${{ steps.branch-name.outputs.current_branch }})
48+
echo "E2E_IMAGE_TAG="${BRANCH_NAME} >> $GITHUB_OUTPUT
49+
echo "E2E_IMAGE_TAG_COMMIT=${BRANCH_NAME}-${COMMIT_SHA}" >> $GITHUB_OUTPUT
4450
4551
- name: Build and push E2E test image
4652
env:
4753
E2E_IMAGE: ${{ env.E2E_IMAGE_TAG_BASE }}:${{ steps.image-tag.outputs.E2E_IMAGE_TAG }}
54+
E2E_IMAGE_COMMIT: ${{ env.E2E_IMAGE_TAG_BASE }}:${{ steps.image-tag.outputs.E2E_IMAGE_TAG_COMMIT }}
4855
run: |
4956
echo "Building E2E test image: ${E2E_IMAGE}"
5057
podman build \
5158
--platform linux/amd64 \
5259
-f Dockerfiles/e2e-tests/e2e-tests.Dockerfile \
53-
-t "${E2E_IMAGE}" \
60+
-t "${E2E_IMAGE}" -t "${E2E_IMAGE_COMMIT}" \
5461
.
5562
5663
echo "Pushing E2E test image: ${E2E_IMAGE}"
5764
podman push "${E2E_IMAGE}"
5865
66+
echo "Pushing E2E test image: ${E2E_IMAGE_COMMIT}"
67+
podman push "${E2E_IMAGE_COMMIT}"
68+
5969
echo "E2E test image built and pushed successfully!"

.github/workflows/release-staging.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
- name: Clean up bundle files
5555
run: |
56-
sed -i -e "s|image: quay.io/opendatahub/opendatahub-operator:latest.*|image: REPLACE_IMAGE:latest|g" bundle/manifests/opendatahub-operator.clusterserviceversion.yaml
56+
sed -i -e "s|image: quay.io/opendatahub/opendatahub-operator:latest.*|image: REPLACE_IMAGE:latest|g" odh-bundle/manifests/opendatahub-operator.clusterserviceversion.yaml
5757
rm -f ./config/manager/kustomization.yaml
5858
5959
- name: Update branches in get_all_manifest.sh
@@ -135,5 +135,5 @@ jobs:
135135
{
136136
"component": "opendatahub-operator",
137137
"release_branch": "odh-${{ env.VERSION }}",
138-
"version": "v${{ env.VERSION }}"
138+
"version": "${{ env.VERSION }}"
139139
}

.github/workflows/test-integration.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ on:
66
branches:
77
- main
88
paths:
9-
- 'bundle/**'
9+
- 'odh-bundle/**'
10+
- 'rhoai-bundle/**'
1011
- 'config/**'
1112
- 'Dockerfiles/**'
1213
- 'internal/**'

.github/workflows/test-prometheus-unit.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ name: Run prometheus unit tests
22
on:
33
pull_request:
44
paths:
5-
- 'config/monitoring/prometheus/**'
6-
- 'tests/prometheus_unit_tests/**'
5+
- 'internal/controller/components/**/monitoring/*-prometheusrules.tmpl.yaml'
6+
- 'internal/controller/components/**/monitoring/*-alerting.unit-tests.yaml'
7+
- 'tests/prometheus_unit_tests/scripts/**'
8+
- 'Makefile'
79
jobs:
810
build:
911
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)