Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ce884d4
add workflow regression-test-forked-branch
pinis-gini-apps Sep 19, 2024
e09b2a5
Merge pull request #33 from pinis-gini-apps/remote-regression-test-runs
EZheln Sep 19, 2024
e468ac2
test run
Sep 19, 2024
0d20fbb
merge with ui-ci-orkor files relevant to tests
pinis-gini-apps Sep 19, 2024
f94dcde
Merge pull request #34 from pinis-gini-apps/remote-regression-test-runs
EZheln Sep 19, 2024
da9db9e
add workflow regression-test-forked-branch
pinis-gini-apps Sep 19, 2024
c9754e5
test run
Sep 19, 2024
afcd400
Merge branch 'remote-regression-test-runs' of github.com:EZheln/ui in…
Sep 22, 2024
a722e84
add workflow regression-test-forked-branch
pinis-gini-apps Sep 19, 2024
59a068d
merge with ui-ci-orkor files relevant to tests
pinis-gini-apps Sep 19, 2024
c47ea90
Merge branch 'remote-regression-test-runs' of github.com:EZheln/ui in…
Sep 25, 2024
f4724cc
add workflow regression-test-forked-branch
pinis-gini-apps Sep 19, 2024
dee50da
merge with ui-ci-orkor files relevant to tests
pinis-gini-apps Sep 19, 2024
29a1f8b
Merge branch 'remote-regression-test-runs' of github.com:EZheln/ui in…
Sep 29, 2024
e4c6442
Merge branch 'development' into remote-regression-test-runs
EZheln Oct 1, 2024
3c89f24
Merge branch 'development' into remote-regression-test-runs
EZheln Oct 4, 2024
9a415ff
Merge branch 'development' into remote-regression-test-runs
EZheln Oct 7, 2024
78e3712
Merge branch 'development' into remote-regression-test-runs
EZheln Oct 9, 2024
a875137
Merge branch 'development' into remote-regression-test-runs
EZheln Oct 10, 2024
58c709d
Merge branch 'development' into remote-regression-test-runs
EZheln Oct 15, 2024
5bc76ac
Merge branch 'development' into remote-regression-test-runs
EZheln Oct 16, 2024
1ff8247
Merge branch 'development' into remote-regression-test-runs
EZheln Oct 23, 2024
880badc
Merge branch 'development' into remote-regression-test-runs
EZheln Oct 28, 2024
5568596
Merge branch 'development' into remote-regression-test-runs
EZheln Nov 7, 2024
d9fb412
Merge branch 'development' into remote-regression-test-runs
EZheln Nov 9, 2024
5644d64
Merge branch 'development' into remote-regression-test-runs
EZheln Nov 12, 2024
6961589
Merge branch 'development' into remote-regression-test-runs
EZheln Nov 13, 2024
79e20d6
Merge branch 'development' into remote-regression-test-runs
EZheln Nov 25, 2024
4e9d0f3
Merge branch 'development' into remote-regression-test-runs
EZheln Nov 26, 2024
ba67f20
Merge branch 'development' into remote-regression-test-runs
EZheln Nov 26, 2024
356464d
Merge branch 'development' into remote-regression-test-runs
EZheln Nov 27, 2024
c8ddd3f
Merge branch 'development' into remote-regression-test-runs
EZheln Nov 28, 2024
31df1d3
Merge branch 'development' into remote-regression-test-runs
EZheln Dec 3, 2024
cd99413
Merge branch 'development' into remote-regression-test-runs
EZheln Dec 5, 2024
aec72fe
Merge branch 'development' into remote-regression-test-runs
EZheln Dec 6, 2024
1c8ec7b
Merge branch 'development' into remote-regression-test-runs
EZheln Dec 27, 2024
7192bbb
Merge branch 'development' into remote-regression-test-runs
EZheln Jan 13, 2025
41cf7dd
Merge branch 'development' into remote-regression-test-runs
EZheln Feb 2, 2025
14780bd
update actions/upload-artifact to v4
pinis-gini-apps Feb 2, 2025
3cdedb0
Merge pull request #44 from pinis-gini-apps/remote-regression-test-runs
EZheln Feb 2, 2025
1102c06
Merge branch 'development' into remote-regression-test-runs
EZheln Feb 4, 2025
6b3a39e
Merge branch 'development' into remote-regression-test-runs
EZheln Feb 7, 2025
d53c402
Merge branch 'development' into remote-regression-test-runs
EZheln Feb 11, 2025
7f183a8
Merge branch 'development' into remote-regression-test-runs
EZheln Feb 11, 2025
736f074
Merge branch 'development' into remote-regression-test-runs
EZheln Feb 13, 2025
98226ba
Added tag conditioning to regression test workflow
barsGiniApps Feb 16, 2025
b28cb1f
edited workflow to trigger on pr with label @require-test (#1)
barsGiniApps Feb 17, 2025
01a6b98
divided workflow into 2 jobs
barsGiniApps Feb 17, 2025
6bf9ce5
added condition that pr has to come from forked repo
barsGiniApps Feb 17, 2025
f45ce24
change logic for "comment-pr" job
barsGiniApps Feb 17, 2025
ee60033
changed regression tests workflow name
barsGiniApps Feb 17, 2025
5f20772
fixed logic for workflow_dispatch
barsGiniApps Feb 17, 2025
3867bc0
added pr base repo check
barsGiniApps Feb 17, 2025
00d6716
Merge branch 'mlrun:development' into regression-test-testing
barsGiniApps Feb 17, 2025
b677276
Workflow test branch (#7)
barsGiniApps Feb 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .github/workflows/regression-test-forked-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Regression Tests Forked Branch

on:
workflow_dispatch:
push:
branches:
- remote-regression-test-runs
pull_request:
types: [labeled, opened, reopened, synchronize]

jobs:
run-tests:
name: Regression Tests - Run tests
runs-on: ubuntu-24.04
if: >
github.event_name == 'workflow_dispatch' ||
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Require Test') &&
github.event.pull_request.head.repo.fork == true &&
github.event.pull_request.base.ref == 'development'
)
env:
REACT_APP_FUNCTION_CATALOG_URL: ${{ secrets.REACT_APP_FUNCTION_CATALOG_URL }}
REACT_APP_MLRUN_API_URL: ${{ secrets.REACT_APP_MLRUN_API_URL }}
REACT_APP_NUCLIO_API_URL: ${{ secrets.REACT_APP_NUCLIO_API_URL }}
REACT_APP_IGUAZIO_API_URL: ${{ secrets.REACT_APP_IGUAZIO_API_URL }}
outputs:
failed_step: ${{ steps.identify_failure.outputs.FAILED_STEP }}
job_status: ${{ job.status }}
steps:

- name: Display GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"

- name: Checkout code
id: checkout_code
uses: actions/checkout@v4

- name: Set up Node.js
id: setup_node
uses: actions/setup-node@v4
with:
node-version: '16'

- name: Install dependencies
id: install_dependencies
run: npm install

- name: Run parallel tasks
id: run_parallel_tasks
run: |
npm run add-comment-to-http-client &
npm run mock-server &
npm start &
npm run test:regression

- name: Upload test reports
id: upload_reports
uses: actions/upload-artifact@v4
with:
name: test-reports
path: tests/reports/
if-no-files-found: error

- name: Identify failed step
if: ${{ always() }}
id: identify_failure
run: |
FAILED_STEP=""
if [ "${{ steps.checkout_code.outcome }}" = "failure" ]; then
FAILED_STEP="Checkout code"
elif [ "${{ steps.setup_node.outcome }}" = "failure" ]; then
FAILED_STEP="Set up Node.js"
elif [ "${{ steps.install_dependencies.outcome }}" = "failure" ]; then
FAILED_STEP="Install dependencies"
elif [ "${{ steps.run_parallel_tasks.outcome }}" = "failure" ]; then
FAILED_STEP="Run parallel tasks"
elif [ "${{ steps.upload_reports.outcome }}" = "failure" ]; then
FAILED_STEP="Upload test reports"
fi
echo "failed_step=$FAILED_STEP" >> $GITHUB_OUTPUT

comment-pr:
name: Regression Test - comment on PR
runs-on: ubuntu-24.04
needs: run-tests
if: >
github.event_name == 'workflow_dispatch' ||
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Require Test') &&
github.event.pull_request.head.repo.fork == true &&
github.event.pull_request.base.ref == 'development'
) && always()
env:
JOB_STATUS: ${{ needs.run-tests.result }}
FAILED_STEP: ${{ needs.run-tests.outputs.failed_step }}
steps:
- name: Post PR comment (success, failure, or cancelled)
uses: actions/github-script@v6
with:
script: |
const jobStatus = process.env.JOB_STATUS;
const failedStep = process.env.FAILED_STEP;

if (jobStatus === 'success') {
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "**Regression Test workflow finished successfully.** ✅"
});
} else if (jobStatus === 'cancelled') {
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "**Regression Test workflow was cancelled.** ⚠️"
});
} else if (jobStatus === 'failure') {
let body = "**Regression Test workflow failed.** ❌";
if (failedStep) {
body += `\nFailed step: **${failedStep}**`;
} else {
body += "\nFailed step: Unknown";
}
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body
});
}

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@
"build-storybook": "build-storybook",
"mock-server": "node scripts/mockServer.js",
"mock-server:dev": "nodemon --watch tests/mockServer scripts/mockServer.js",
"add-comment-to-http-client": "node scripts/ci-cd-scripts/appendCommentToHttpClient.js",
"test:ui": "node scripts/testui.js",
"report": "node tests/report.js",
"test:regression": "npm run test:ui && npm run report",
"test:regression": "HEADLESS=true npm run test:ui && sleep 10 && echo 'Finished regression' && sleep 10 && npm run report",
"start:regression": "concurrently \"npm:mock-server\" \"npm:start\" \"npm:test:regression\"",
"ui-steps": "export BABEL_ENV=test; export NODE_ENV=test; npx -p @babel/core -p @babel/node babel-node --presets @babel/preset-env scripts/collectUITestsSteps.js",
"nli": "npm link iguazio.dashboard-react-controls",
Expand Down
34 changes: 34 additions & 0 deletions scripts/ci-cd-scripts/appendCommentToHttpClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Copyright 2019 Iguazio Systems Ltd.

Licensed under the Apache License, Version 2.0 (the "License") with
an addition restriction as set forth herein. You may not use this
file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.

In addition, you may not use the software for any purposes that are
illegal under applicable law, and the grant of the foregoing license
under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
const fs = require('fs')
const path = require('path')

const sourceFilePath = path.join(__dirname, 'commentedHttpClient.js')
const targetFilePath = path.join(__dirname, '../../src/httpClient.js')

try {
const fileContent = fs.readFileSync(sourceFilePath, 'utf-8')
fs.writeFileSync(targetFilePath, fileContent)

console.log(`Successfully overwritten ${targetFilePath} with content from ${sourceFilePath}`)
} catch (err) {
console.error(`Error occurred: ${err.message}`)
process.exit(1)
}
194 changes: 194 additions & 0 deletions scripts/ci-cd-scripts/commentedHttpClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
/*
Copyright 2019 Iguazio Systems Ltd.

Licensed under the Apache License, Version 2.0 (the "License") with
an addition restriction as set forth herein. You may not use this
file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.

In addition, you may not use the software for any purposes that are
illegal under applicable law, and the grant of the foregoing license
under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
import axios from 'axios'
import qs from 'qs'

// import { ConfirmDialog } from 'igz-controls/components'
import {
CANCEL_REQUEST_TIMEOUT,
LARGE_REQUEST_CANCELED
// PROJECTS_PAGE_PATH
} from './constants'
// import { openPopUp } from 'igz-controls/utils/common.util'
// import { mlrunUnhealthyErrors } from './components/ProjectsPage/projects.util'

const headers = {
'Cache-Control': 'no-cache'
}

// serialize a param with an array value as a repeated param, for example:
// { label: ['host', 'owner=admin'] } => 'label=host&label=owner%3Dadmin'
const paramsSerializer = params => qs.stringify(params, { arrayFormat: 'repeat' })

// const MAX_CONSECUTIVE_ERRORS_COUNT = 2
// let consecutiveErrorsCount = 0

export const mainBaseUrl = `${process.env.PUBLIC_URL}/api/v1`
export const mainBaseUrlV2 = `${process.env.PUBLIC_URL}/api/v2`

export const mainHttpClient = axios.create({
baseURL: mainBaseUrl,
headers,
paramsSerializer
})

export const mainHttpClientV2 = axios.create({
baseURL: mainBaseUrlV2,
headers,
paramsSerializer
})

export const functionTemplatesHttpClient = axios.create({
baseURL: `${process.env.PUBLIC_URL}/function-catalog`,
headers
})

export const nuclioHttpClient = axios.create({
baseURL: `${process.env.PUBLIC_URL}/nuclio/api`,
headers
})

export const iguazioHttpClient = axios.create({
baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/iguazio/api',
headers
})

const getAbortSignal = (controller, abortCallback, timeoutMs) => {
let timeoutId = null
const newController = new AbortController()
const abortController = controller || newController

if (timeoutMs) {
timeoutId = setTimeout(() => abortController.abort(LARGE_REQUEST_CANCELED), timeoutMs)
}

abortController.signal.onabort = event => {
if (timeoutId) {
clearTimeout(timeoutId)
}

if (abortCallback) {
abortCallback(event)
}
}

return [abortController.signal, timeoutId]
}

let requestId = 1
let requestTimeouts = {}
let largeResponsePopUpIsOpen = false

const requestLargeDataOnFulfill = config => {
if (config?.ui?.setLargeRequestErrorMessage) {
const [signal, timeoutId] = getAbortSignal(
config.ui?.controller,
abortEvent => {
if (abortEvent.target.reason === LARGE_REQUEST_CANCELED) {
showLargeResponsePopUp(config.ui.setLargeRequestErrorMessage)
}
},
CANCEL_REQUEST_TIMEOUT
)

config.signal = signal

requestTimeouts[requestId] = timeoutId
config.ui.requestId = requestId
requestId++
}

return config
}
const requestLargeDataOnReject = error => {
return Promise.reject(error)
}
const responseFulfillInterceptor = response => {
// consecutiveErrorsCount = 0

if (response.config?.ui?.requestId) {
const isLargeResponse =
response.data?.total_size >= 0
? response.data.total_size > 10000
: Object.values(response.data)?.[0]?.length > 10000

clearTimeout(requestTimeouts[response.config.ui.requestId])
delete requestTimeouts[response.config.ui.requestId]

if (isLargeResponse) {
showLargeResponsePopUp(response.config.ui.setLargeRequestErrorMessage)

throw new Error(LARGE_REQUEST_CANCELED)
} else {
response.config.ui.setLargeRequestErrorMessage('')
}
}

return response
}
const responseRejectInterceptor = error => {
if (error.config?.ui?.requestId) {
clearTimeout(requestTimeouts[error.config.ui.requestId])
delete requestTimeouts[error.config.ui.requestId]
}

// if (error.config?.method === 'get') {
// if (
// mlrunUnhealthyErrors.includes(error.response?.status) &&
// consecutiveErrorsCount < MAX_CONSECUTIVE_ERRORS_COUNT
// ) {
// consecutiveErrorsCount++
//
// if (
// consecutiveErrorsCount === MAX_CONSECUTIVE_ERRORS_COUNT &&
// window.location.pathname !== `/${PROJECTS_PAGE_PATH}`
// ) {
// window.location.href = '/projects'
// }
// }
// }

return Promise.reject(error)
}

// Request interceptors
mainHttpClient.interceptors.request.use(requestLargeDataOnFulfill, requestLargeDataOnReject)
mainHttpClientV2.interceptors.request.use(requestLargeDataOnFulfill, requestLargeDataOnReject)

// Response interceptors
mainHttpClient.interceptors.response.use(responseFulfillInterceptor, responseRejectInterceptor)
mainHttpClientV2.interceptors.response.use(responseFulfillInterceptor, responseRejectInterceptor)

export const showLargeResponsePopUp = setLargeRequestErrorMessage => {
if (!largeResponsePopUpIsOpen) {
const errorMessage =
'The query result is too large to display. Add a filter (or narrow it) to retrieve fewer results.'

setLargeRequestErrorMessage(errorMessage)
largeResponsePopUpIsOpen = true

// openPopUp(ConfirmDialog, {
// message: errorMessage,
// closePopUp: () => {
// largeResponsePopUpIsOpen = false
// }
// })
}
}
Loading
Loading