Skip to content

Commit

Permalink
wesh
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed Oct 11, 2023
1 parent ab4ec11 commit 1750a77
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
15 changes: 7 additions & 8 deletions defaults/monitoring/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ stages:
- monitor

# Use sfdx-hardis docker image to always be up to date with latest version
image: hardisgroupcom/sfdx-hardis:latest
image: hardisgroupcom/sfdx-hardis:latest # test with alpha

# Metadata backup
backup:
stage: backup
interruptible: true
#tags:
# - ubuntu
before_script:
Expand All @@ -30,17 +31,13 @@ backup:
# Commit and push new state
- git status
- git add --all
- git commit -m "$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME org state on $(date -u +'%Y-%m-%d %H:%M') [skip ci]" || echo "No changes to commit"
- git commit -m "Org state on $(date -u +'%Y-%m-%d %H:%M') for $CI_COMMIT_REF_NAME [skip ci]" || echo "No changes to commit"
- git push -o ci-skip https://root:$ACCESS_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git HEAD:$CI_COMMIT_REF_NAME
artifacts:
when: always
paths:
- hardis-report
expire_in: 6 month

# Apex tests
apex_tests:
stage: monitor
interruptible: true
#tags:
# - ubuntu
before_script:
Expand All @@ -59,6 +56,7 @@ apex_tests:
# Apex tests
monitoring_tools:
stage: monitor
interruptible: true
#tags:
# - ubuntu
before_script:
Expand All @@ -77,6 +75,7 @@ monitoring_tools:
# Check code quality and good practices using MegaLinter
megalinter:
stage: monitor
interruptible: true
#tags:
# - ubuntu
image: oxsecurity/megalinter-salesforce:latest
Expand All @@ -91,5 +90,5 @@ megalinter:
artifacts:
when: always
paths:
- report
- megalinter-reports
expire_in: 6 month
3 changes: 2 additions & 1 deletion docs/salesforce-monitoring-config-gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ description: Learn how to configure a monitoring repository for a Salesforce Org

- Go to **Project -> Settings > Access Token** _(you must have Gitlab authorizations to access this menu)_
- Create an access token with the following info:
- name: **ACCESS_TOKEN**
- name: **SFDX HARDIS MONITORING**
- role: **Developer**
- scopes: **read_repository, write_repository**
- Copy the value of the generated token in your clipboard ! (CTRL+C)

Expand Down
16 changes: 8 additions & 8 deletions src/commands/hardis/org/configure/monitoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class OrgConfigureMonitoring extends SfdxCommand {

// Build monitoring branch name
const branchName =
"monitoring-" +
"monitoring_" +
this.org
?.getConnection()
.instanceUrl.replace("https://", "")
Expand All @@ -126,15 +126,15 @@ export default class OrgConfigureMonitoring extends SfdxCommand {
uxLog(this, c.cyan("Moving sfdx-project to root..."));
await fs.copy("sfdx-hardis-monitoring", process.cwd(), { overwrite: true });
await fs.remove("sfdx-hardis-monitoring");
}

// Copying monitoring folder structure
uxLog(this, "Copying default monitoring files...");
if (fs.existsSync("README.md") && fs.readFileSync("README.md", "utf8").toString().split("\n").length < 5) {
// Remove default README if necessary
await fs.remove("README.md");
// Copying monitoring folder structure
uxLog(this, "Copying default monitoring files...");
if (fs.existsSync("README.md") && fs.readFileSync("README.md", "utf8").toString().split("\n").length < 5) {
// Remove default README if necessary
await fs.remove("README.md");
}
await fs.copy(path.join(PACKAGE_ROOT_DIR, "defaults/monitoring", "."), process.cwd(), { overwrite: true });
}
await fs.copy(path.join(PACKAGE_ROOT_DIR, "defaults/monitoring", "."), process.cwd(), { overwrite: false });

// Update config file
await setInConfigFile(
Expand Down

0 comments on commit 1750a77

Please sign in to comment.