7880ae781f
Updated the GitLab CI configuration to properly format the SonarCloud scan script using a multiline approach. This ensures better readability and maintainability of the pipeline configuration.
52 lines
1.2 KiB
YAML
52 lines
1.2 KiB
YAML
default:
|
|
image: maven:3-amazoncorretto-17-alpine
|
|
|
|
stages:
|
|
- pull
|
|
- on_commit
|
|
- sonarcloud_scan
|
|
|
|
variables:
|
|
GITLAB_CLONE_DIR: "/builds/thischwa/CloudflareDNS-java"
|
|
# GITLAB_CLONE_DIR: "cloudflaredns-java"
|
|
SONAR_HOST_URL: "https://sonarcloud.io"
|
|
SONAR_PROJECT_KEY: "th-schwarz_DynDRest"
|
|
SONAR_ORGANIZATION: "th-schwarz"
|
|
SONAR_TOKEN: "${SONAR_TOKEN_ENV_VAR}"
|
|
|
|
|
|
pull_source:
|
|
stage: pull
|
|
script:
|
|
- echo "Cloning GitHub repository..."
|
|
- git clone --depth 1 https://oauth2:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/th-schwarz/CloudflareDNS-java.git ${GITLAB_CLONE_DIR}
|
|
- echo "Repository cloned successfully."
|
|
only:
|
|
- schedules
|
|
|
|
|
|
on_commits:
|
|
stage: on_commit
|
|
script:
|
|
- echo "Running tests..."
|
|
- cd ${GITLAB_CLONE_DIR}
|
|
- mvn clean test
|
|
only:
|
|
- /^feature.*$/
|
|
- develop
|
|
|
|
sonarcloud_scan:
|
|
stage: sonarcloud_scan
|
|
script:
|
|
- echo "Setting up SonarCloud scan..."
|
|
- cd ${GITLAB_CLONE_DIR}
|
|
- |
|
|
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
|
|
-Dsonar.host.url=${SONAR_HOST_URL} \
|
|
-Dsonar.projectKey=${SONAR_PROJECT_KEY} \
|
|
-Dsonar.organization=${SONAR_ORGANIZATION} \
|
|
-Dsonar.login=${SONAR_TOKEN}
|
|
|
|
only:
|
|
- develop
|