63284b19bc
The GitLab CI configuration variables have been updated to reflect changes in the project location. The updates include adjustments to the clone directory, project key, and organization, ensuring that Sonar analysis and GitLab CI operations are correctly configured for the relocated project.
76 lines
1.7 KiB
YAML
76 lines
1.7 KiB
YAML
default:
|
|
image: maven:3-amazoncorretto-17-alpine
|
|
|
|
stages:
|
|
#- pull
|
|
- build
|
|
- on_commit
|
|
- sonarcloud_scan
|
|
|
|
variables:
|
|
GITLAB_CLONE_DIR: "/builds/ths6435116/CloudflareDNS-java"
|
|
# GITLAB_CLONE_DIR: "cloudflaredns-java"
|
|
SONAR_HOST_URL: $SONAR_HOST_URL
|
|
SONAR_PROJECT_KEY: "ths6435116_CloudflareDNS-java"
|
|
SONAR_ORGANIZATION: "ths6435116"
|
|
SONAR_TOKEN: $SONAR_TOKEN # Ensure this token is correctly set in GitLab CI/CD variables
|
|
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
|
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
|
API_EMAIL: $API_EMAIL
|
|
API_KEY: $API_KEY
|
|
API_TOKEN: $API_TOKEN
|
|
|
|
build:
|
|
stage: build
|
|
script:
|
|
- echo "Running package..."
|
|
- cd ${GITLAB_CLONE_DIR}
|
|
- mvn clean package
|
|
artifacts:
|
|
paths:
|
|
- target/
|
|
|
|
on_commits:
|
|
stage: on_commit
|
|
dependencies:
|
|
- build
|
|
script:
|
|
- echo "on_commit DONE"
|
|
only:
|
|
- /^feature.*$/
|
|
- merge_request
|
|
- develop
|
|
|
|
sonarcloud_scan:
|
|
stage: sonarcloud_scan
|
|
dependencies:
|
|
- build
|
|
image:
|
|
name: sonarsource/sonar-scanner-cli:latest
|
|
entrypoint: [ "" ]
|
|
script:
|
|
- |
|
|
sonar-scanner \
|
|
-Dsonar.projectKey=${SONAR_PROJECT_KEY} \
|
|
-Dsonar.organization=${SONAR_ORGANIZATION} \
|
|
-Dsonar.token=${SONAR_TOKEN} \
|
|
-Dsonar.branch.name=develop \
|
|
-Dsonar.test.exclusions=src/test/java/**/* \
|
|
-Dsonar.exclusions=docs/** \
|
|
-Dsonar.java.binaries=target/classes
|
|
only:
|
|
- merge_requests
|
|
- develop
|
|
|
|
pages:
|
|
stage: on_commit
|
|
script:
|
|
- echo "Deploying GitLab Pages from docs/"
|
|
- mkdir public
|
|
- cp -r docs/* public/
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
only:
|
|
- develop
|