Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d6c2408
chore(ci): resync (#55)
sc979 Aug 12, 2024
b08396b
chore(ci): resync gh workflow files (#56)
sc979 Aug 12, 2024
abf23be
remove gorgone (#58)
sc979 Aug 12, 2024
40e8f69
resynchro (#59)
sc979 Sep 6, 2024
98ef78b
feat(ci): external_contrib v9 (#69)
sc979 Sep 10, 2024
5fae246
fix environment name (#72)
mushroomempires Sep 11, 2024
98dd572
fix: me (#74)
tuntoja Sep 11, 2024
81e76b2
fix author_association github variable access (#73)
mushroomempires Sep 11, 2024
9ef261a
add push
mushroomempires Sep 11, 2024
c3952eb
contributor instead of contribution
mushroomempires Sep 11, 2024
df21d8d
test change on dsm with internal contributor (#75)
mushroomempires Sep 11, 2024
16cb491
rollback on check status (#81)
mushroomempires Sep 11, 2024
94c1498
Test external v3 (#82)
sc979 Sep 12, 2024
7365e6e
Test external v4 (#83)
sc979 Sep 13, 2024
97c09b5
skip critical stesp (#84)
sc979 Sep 13, 2024
6d2cb16
test me (#85)
sc979 Sep 13, 2024
e8a9ef4
cleaning (#86)
sc979 Sep 13, 2024
3a777c4
je casse tout (#87)
thunto Sep 16, 2024
922db06
env secret (#89)
sc979 Sep 16, 2024
49bde7c
Test owners7 (#92)
sc979 Sep 16, 2024
6340792
update set environement condition (#93)
tuntoja Sep 18, 2024
ef3d361
check secret (#96)
sc979 Sep 18, 2024
5681567
Test owners10 (#98)
sc979 Sep 18, 2024
42e16cb
test dsm (#94)
sc979 Sep 18, 2024
2fece30
Test owners 12 (#100)
sc979 Sep 18, 2024
d70949d
fix secret (#101)
sc979 Sep 18, 2024
93212fa
fix quotes (#103)
sc979 Sep 18, 2024
5e995fe
enh(ci): simplify environment conditions (#104)
kduret Sep 26, 2024
c813872
Update container.php
kduret-external Sep 26, 2024
8a6a0b6
fix(ci): fix condition to set pull request environment output (#106)
kduret Sep 27, 2024
362f1d5
Merge branch 'develop' into patch-1
kduret Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
20 changes: 20 additions & 0 deletions .coderabbit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: "en-US"
early_access: false
reviews:
profile: "chill"
request_changes_workflow: false
high_level_summary: false
poem: false
review_status: false
collapse_walkthrough: true
abort_on_close: true
auto_review:
enabled: true
drafts: false
path_filters:
- "!*.po"
- "!*.md"
- "!*.rst"
chat:
auto_reply: false
10 changes: 4 additions & 6 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ tsconfig.json @centreon/owners-react
*.jsx @centreon/owners-react
**/cypress/** @centreon/owners-react

centreon-gorgone/ @centreon/owners-perl
centreon-gorgone/docs/ @centreon/owners-doc
centreon-gorgone/tests/ @centreon/owners-robot-e2e

centreon-gorgone/tests/robot/config/ @centreon/owners-perl
*.pm @centreon/owners-perl
*.pl @centreon/owners-perl

Expand All @@ -55,5 +50,8 @@ centreon-gorgone/tests/robot/config/ @centreon/owners-perl
**/project/ @centreon/owners-pipelines
**/packaging/ @centreon/owners-pipelines
dependencies/** @centreon/owners-pipelines
.coderabbit.yml @centreon/owners-pipelines

**/config/features.json @centreon/release-management

**/config/features.json @centreon/release-management
**/tests/rest_api/** @centreon/owners-api-testing
28 changes: 28 additions & 0 deletions .github/actions/check-latest-nightly-status/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "check-latest-nightly-status"
description: "Check the status of the latest nightly build"
outputs:
last_nightly_result:
description: "The status of the latest nightly build (success or failure)"
value: ${{ steps.check-latest-nightly-status.outputs.last_nightly_result }}

runs:
using: "composite"
steps:
- name: Check the status of the latest nightly build
id: check-latest-nightly-status
run: |
set -x

echo "[INFO]: Filtering the results of the last nightly build"
lastNightlyRunDetails=$(gh run ls \
--json number,status,conclusion \
--event schedule \
--workflow web.yml \
--branch develop \
--limit 1)

echo "Last nightly run details:"
echo "$lastNightlyRunDetails"

echo "last_nightly_result=$(echo "$lastNightlyRunDetails" | jq -r '.[0].conclusion')" >> $GITHUB_OUTPUT
shell: bash
2 changes: 1 addition & 1 deletion .github/actions/chromatic/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ runs:
using: "composite"

steps:
- uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 8
run_install: false
Expand Down
10 changes: 10 additions & 0 deletions .github/actions/code-coverage-gate-keeper/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ inputs:
name:
description: 'The name for display purpose'
required: true
dynamicCodeCoveragesFilePath:
required: true
description: 'The path to the dynamic code coverages file'
generateNewCodeCoverages:
required: false
default: 'false'
description: 'Generates new code coverages bas stats or not'
outputs:
has_new_code_coverage:
description: 'This tells if a new code coverages file has been generated'

runs:
using: 'node20'
Expand Down
224 changes: 132 additions & 92 deletions .github/actions/code-coverage-gate-keeper/index.js
Original file line number Diff line number Diff line change
@@ -1,92 +1,132 @@
const core = require('@actions/core');
const { getOctokit, context } = require('@actions/github');
const fs = require('fs');
const { execSync } = require('child_process');

const limit = 20;

const getExistingComments = async ({ octokit, context, title }) => {
let page = 0;
let results = [];
let response;

do {
response = await octokit.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
per_page: limit,
page: page,
});
results = results.concat(response.data);
page = page + 1;
} while (response.data.length === limit)

return results.filter(
comment => !!comment.user && comment.body.includes(title),
)
}

const deleteOldComments = async ({ octokit, context, title }) => {
const existingComments = await getExistingComments({ octokit, context, title })

existingComments.forEach((existingComment) => {
core.debug(`Deleting comment: ${existingComment.id}`)
try {
octokit.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
})
} catch (error) {
console.error(error)
}
})
}

const run = async () => {
try {
const modulePath = core.getInput('module_path');
const githubToken = core.getInput('github_token');
const name = core.getInput('name');

if (context.payload.pull_request === null) {
return;
}

execSync('pnpx nyc report --reporter json-summary --report-dir /tmp');

const coverageFile = fs.readFileSync('/tmp/coverage-summary.json');
const coverage = JSON.parse(coverageFile);

const package = fs.readFileSync(`${modulePath}/package.json`);
const baseCodeCoveragePercentage =JSON.parse(package).baseCodeCoveragePercentage

const codeCoverageLines = coverage.total.lines.pct;

const passGateKeep = codeCoverageLines >= baseCodeCoveragePercentage;

const octokit = getOctokit(githubToken);

const title = `Code Coverage Check on ${name}`;

await deleteOldComments({ octokit, context, title })

core.info(`Pass the gate keep? ${passGateKeep} (INFO: lines: ${codeCoverageLines}, base percentage: ${baseCodeCoveragePercentage})`)

if (!passGateKeep) {
const pull_request_number = context.payload.pull_request.number;
octokit.rest.issues.createComment({
...context.repo,
issue_number: pull_request_number,
body: `<h2>📋 ${title} ❌</h2>
Your code coverage is <b>${codeCoverageLines}%</b> but the required code coverage is <b>${baseCodeCoveragePercentage}%</b>.`
});
core.setFailed(`Does not pass the code coverage check (${codeCoverageLines}% instead of ${baseCodeCoveragePercentage}%)`);
}
} catch (error) {
core.setFailed(error.message);
}
}

run();
const core = require('@actions/core');
const { getOctokit, context } = require('@actions/github');
const fs = require('fs');
const { execSync } = require('child_process');

const limit = 20;

const getExistingComments = async ({ octokit, context, title }) => {
let page = 0;
let results = [];
let response;

do {
response = await octokit.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
per_page: limit,
page: page
});
results = results.concat(response.data);
page = page + 1;
} while (response.data.length === limit);

return results.filter(
(comment) => !!comment.user && comment.body.includes(title)
);
};

const deleteOldComments = async ({ octokit, context, title }) => {
const existingComments = await getExistingComments({
octokit,
context,
title
});

existingComments.forEach((existingComment) => {
core.info(`Deleting comment: ${existingComment.id}`);
try {
octokit.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id
});
} catch (error) {
console.error(error);
}
});
};

const run = async () => {
try {
const modulePath = core.getInput('module_path');
const githubToken = core.getInput('github_token');
const name = core.getInput('name');
const dynamicCodeCoveragesFilePath = core.getInput(
'dynamicCodeCoveragesFilePath'
);
const generateNewCodeCoverages = core.getBooleanInput(
'generateNewCodeCoverages'
);

execSync('pnpx nyc report --reporter json-summary --report-dir /tmp');

const coverageFile = fs.readFileSync('/tmp/coverage-summary.json');
const coverage = JSON.parse(coverageFile);
const module = modulePath.replaceAll('/', '-');
const codeCoverageLines = coverage.total.lines.pct;
const codeCoverages = JSON.parse(
fs.readFileSync(dynamicCodeCoveragesFilePath)
);
const baseCodeCoveragePercentage = codeCoverages[module];
const lowerBaseCodeCoverage = baseCodeCoveragePercentage - 0.04;

const passGateKeep =
codeCoverageLines >= lowerBaseCodeCoverage ||
codeCoverageLines >= baseCodeCoveragePercentage;
const strictlyPassGateKeep =
codeCoverageLines >= baseCodeCoveragePercentage;

if (generateNewCodeCoverages) {
if (!strictlyPassGateKeep) {
core.info(
`Cannot update base percentage for ${module}. Requirement: ${baseCodeCoveragePercentage}%. Current: ${codeCoverageLines}%`
);
return;
}
const newCodeCoverages = {
...codeCoverages,
[module]: codeCoverageLines
};
fs.writeFileSync(
'/tmp/newBaseCodeCoverages.json',
JSON.stringify(newCodeCoverages)
);
core.info(`New code coverage for ${module}: ${codeCoverageLines}%`);
core.setOutput('has_new_code_coverage', 'true');
return;
}

const octokit = getOctokit(githubToken);

const title = `Code Coverage Check on ${name}`;

if (context.payload.pull_request) {
await deleteOldComments({ octokit, context, title });
}

core.info(
`Does it pass the gate keep? ${passGateKeep} (INFO: lines: ${codeCoverageLines}, base percentage: ${baseCodeCoveragePercentage})`
);

if (!passGateKeep) {
if (context.payload.pull_request) {
core.info(`Creating comment on pull request.`);
octokit.rest.issues.createComment({
...context.repo,
issue_number: context.payload.pull_request.number,
body: `<h2>📋 ${title} ❌</h2>
Your code coverage is <b>${codeCoverageLines}%</b> but the required code coverage is <b>${baseCodeCoveragePercentage}%</b>.`
});
}
core.setFailed(
`Does not pass the code coverage check (${codeCoverageLines}% instead of ${baseCodeCoveragePercentage}%)`
);
}
} catch (error) {
core.setFailed(error.message);
}
};

run();
24 changes: 22 additions & 2 deletions .github/actions/cypress-e2e-testing/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,33 @@ inputs:
feature_file_path:
description: "feature file"
required: true
test_tags:
description: "filter tests by tags"
required: false
default: "not @ignore"
dependencies_lock_file:
description: "The frontend dependencies lock file path"
required: true
test_execution_key:
description: "xray test execution key"
required: true
stability:
description: "Branch stability"
required: true
is_cloud:
description: "Define if the version is targeting cloud"
required: false
artifactory_internal_repo_username:
description: "Artifactory internal repository username"
required: false
artifactory_internal_repo_password:
description: "Artifactory internal repository password"
required: false

runs:
using: "composite"
steps:
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 8
run_install: false
Expand Down Expand Up @@ -67,7 +83,7 @@ runs:
- name: Cypress end-to-end testing
uses: cypress-io/github-action@1b70233146622b69e789ccdd4f9452adc638d25a # v6.6.1
with:
command: pnpm run cypress:run --browser electron --spec features/**/${{ inputs.feature_file_path }}
command: pnpm run cypress:run --browser electron --spec features/**/${{ inputs.feature_file_path }} --env tags="${{ inputs.test_tags }}"
install: false
working-directory: ${{ inputs.module }}/tests/e2e
publish-summary: false
Expand All @@ -78,6 +94,10 @@ runs:
CYPRESS_WEB_IMAGE_VERSION: ${{ inputs.web_image_version }}
CYPRESS_OPENID_IMAGE_VERSION: ${{ inputs.openid_image_version }}
CYPRESS_SAML_IMAGE_VERSION: ${{ inputs.saml_image_version }}
CYPRESS_STABILITY: ${{ inputs.stability }}
CYPRESS_IS_CLOUD: ${{ inputs.is_cloud }}
CYPRESS_INTERNAL_REPO_USERNAME: ${{ inputs.artifactory_internal_repo_username }}
CYPRESS_INTERNAL_REPO_PASSWORD: ${{ inputs.artifactory_internal_repo_password }}

- name: Ensure logs directory exists
run: mkdir -p ${{ inputs.module }}/tests/e2e/results/cucumber-logs/
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/frontend-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ inputs:
runs:
using: "composite"
steps:
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 8
run_install: false
Expand Down
Loading
Loading