-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61f0b76
commit 714f278
Showing
1 changed file
with
2 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,15 @@ env: | |
ec2_instance_definition: &INSTANCE_DEFINITION | ||
region: eu-central-1 | ||
type: c6i.xlarge | ||
image: sonarlint-visualstudio-v* | ||
image: pr-39-sonarlint-visualstudio-v20250107121045 | ||
platform: windows | ||
|
||
calculate_version_script_definition: &CALCULATE_VERSION_SCRIPT_DEFINITION | | ||
versionProps=$(cat build/Version.props) | ||
sonarProjectVersion=$(echo "$versionProps" | sed -n 's:.*<MainVersion>\(.*\)</MainVersion>.*:\1:p') | ||
echo "SHORT_VERSION=${sonarProjectVersion}" >> $CIRRUS_ENV | ||
echo "PROJECT_VERSION=${sonarProjectVersion}.${CI_BUILD_NUMBER}" >> $CIRRUS_ENV | ||
find /c -name "cl.exe" | ||
|
||
only_sonarsource_qa: &ONLY_SONARSOURCE_QA | ||
$CIRRUS_USER_COLLABORATOR == "true" && $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == "master" || $CIRRUS_BRANCH == "ci-images-verifier" || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "dogfood-on-.*") | ||
|
@@ -57,112 +58,3 @@ build_task: | |
git reset --hard $CIRRUS_CHANGE_IN_REPO | ||
fi | ||
calculate_version_script: *CALCULATE_VERSION_SCRIPT_DEFINITION | ||
prepare_signing_script: | | ||
if [[ "${CIRRUS_BRANCH}" == "${CIRRUS_DEFAULT_BRANCH}" ]] || echo "${CIRRUS_BRANCH}" | grep -qE "^branch-.*" || echo "${CIRRUS_BRANCH}" | grep -qE "^sign-.*"; then | ||
mkdir -p "${TMP_DIR}" | ||
mkdir -p "${LOCALAPPDATA}" | ||
echo "${SONARSOURCE_SNK}" | base64 -d > "${SONARSOURCE_SNK_FILE}" | ||
echo "${SM_CLIENT_CERT_FILE_BASE64}" | base64 -d > "${SM_CLIENT_CERT_FILE}" | ||
echo "${SM_CLIENT_CRT}" > "${SM_CLIENT_CRT_FILE}" | ||
smctl windows certsync | ||
echo "SHOULD_SIGN=true" >> $CIRRUS_ENV | ||
else | ||
echo "SHOULD_SIGN=false" >> $CIRRUS_ENV | ||
fi | ||
set_project_version_script: | | ||
msbuild.exe build/ChangeVersion.proj -p:Sha1=${CIRRUS_CHANGE_IN_REPO} -p:BranchName=${CIRRUS_BRANCH} -p:BuildNumber=${CI_BUILD_NUMBER} -p:BuildConfiguration=Release | ||
download_jar_dependencies_script: | | ||
msbuild.exe build/DownloadDependencies -p:VsVersion=17.0 -p:VsTargetVersion=2022 | ||
dotnet_restore_script: | | ||
dotnet restore "${SOLUTION_PATH}" --locked-mode | ||
prepare_analysis_script: | | ||
.cirrus/sonarqube-cloud-analysis.sh | ||
build_solution_script: | | ||
msbuild.exe "${SOLUTION_PATH}" -p:VsVersion=17.0 -p:VsTargetVersion=2022 -p:SignArtifacts=${SHOULD_SIGN} -p:AssemblyOriginatorKeyFile="${SONARSOURCE_SNK_FILE}" -p:DeployExtension=false -p:Sha1="${CIRRUS_CHANGE_IN_REPO}" -p:BuildNumber="${CI_BUILD_NUMBER}" -p:Configuration=Release | ||
sign_artifact_script: | | ||
if [[ "${SHOULD_SIGN}" == "true" ]]; then | ||
nuget sign "binaries/SonarLint.VSIX-${PROJECT_VERSION}-2022.vsix" -HashAlgorithm SHA256 -CertificateFingerprint ${SM_CERT_FP} -Timestamper http://timestamp.digicert.com -TimestampHashAlgorithm SHA256 | ||
else | ||
echo "Artifact not signed" | ||
fi | ||
generate_sbom_script: | | ||
if [[ "${SHOULD_SIGN}" == "true" ]]; then | ||
sbomname="SonarLint.visualstudio.sbom-${PROJECT_VERSION}-2022.json" | ||
gpg --batch --passphrase "$SIGN_PASSPHRASE" --allow-secret-key-import --import <(echo "$SIGN_KEY") | ||
gpg --list-secret-keys | ||
dotnet CycloneDX "${SOLUTION_PATH}" -t -j -o binaries | ||
cd binaries | ||
mv bom.json $sbomname | ||
gpg --pinentry-mode loopback --passphrase "$SIGN_PASSPHRASE" --armor --detach-sig --default-key [email protected] "$sbomname" | ||
echo "signed $sbomname" | ||
ls -al | ||
fi | ||
binaries_artifacts: | ||
path: "binaries/*" | ||
publish_to_repox_script: | | ||
jf config add repox --artifactory-url ${ARTIFACTORY_URL} --access-token "${ARTIFACTORY_DEPLOY_TOKEN}" | ||
jf rt upload "binaries/*" sonarsource-public-qa/org/sonarsource/sonarlint/visualstudio/${CIRRUS_REPO_NAME}/${PROJECT_VERSION}/ --flat --build-name ${CIRRUS_REPO_NAME} --build-number ${CI_BUILD_NUMBER} --module="org.sonarsource.sonarlint.visualstudio:${CIRRUS_REPO_NAME}:${PROJECT_VERSION}" | ||
jf rt bp ${CIRRUS_REPO_NAME} ${CI_BUILD_NUMBER} | ||
tests_script: | | ||
vstest.console.exe --EnableCodeCoverage --Logger:trx --ResultsDirectory:"TestResults" src/**/bin/**/Sonar*.*Tests.dll | ||
collect_coverage_script: | | ||
dotnet-coverage merge -o "${COVERAGE_FILE}" -f xml "**\*.coverage" | ||
sonarcloud_analysis_script: | | ||
dotnet sonarscanner end -d:sonar.token="${SONAR_TOKEN}" | ||
on_failure: | ||
asmref_artifacts: | ||
path: "src/Integration.Vsix/**/AsmRef_*.txt" | ||
|
||
dogfood_task: | ||
depends_on: | ||
- build | ||
only_if: $CIRRUS_USER_COLLABORATOR == "true" && $CIRRUS_TAG == "" && ($CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "dogfood-on-.*") | ||
ec2_instance: *INSTANCE_DEFINITION | ||
env: | ||
AWS_ACCESS_KEY_ID: VAULT[development/aws/sts/downloads access_key] | ||
AWS_SECRET_ACCESS_KEY: VAULT[development/aws/sts/downloads secret_key] | ||
AWS_SESSION_TOKEN: VAULT[development/aws/sts/downloads security_token] | ||
AWS_DEFAULT_REGION: eu-central-1 | ||
get_binaries_script: | | ||
curl -O "https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/build/binaries.zip" | ||
unzip binaries.zip | ||
calculate_version_script: *CALCULATE_VERSION_SCRIPT_DEFINITION | ||
dogfood_script: | | ||
mkdir -p /tmp/dogfood/${PROJECT_VERSION} | ||
PrivateGalleryCreator.exe --input=binaries --terminate --source="https://binaries.sonarsource.com/SonarLint-for-VisualStudio/dogfood/${PROJECT_VERSION}/" --output=/tmp/dogfood/feed.xml | ||
cp binaries/SonarLint.VSIX-${PROJECT_VERSION}-2022.vsix /tmp/dogfood/${PROJECT_VERSION}/ | ||
.cirrus/publish-dogfood-site.sh /tmp/dogfood | ||
mend_scan_task: | ||
ec2_instance: *INSTANCE_DEFINITION | ||
only_if: $CIRRUS_USER_COLLABORATOR == "true" && $CIRRUS_TAG == "" && ($CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH == "ci-images-verifier" || $CIRRUS_BRANCH =~ "mend-.*") | ||
depends_on: | ||
- build | ||
env: | ||
WS_APIKEY: VAULT[development/kv/data/mend data.apikey] | ||
calculate_version_script: *CALCULATE_VERSION_SCRIPT_DEFINITION | ||
mend_scan_script: | | ||
source cirrus-env QA | ||
export WS_PRODUCTNAME="SonarLint/VisualStudio" | ||
export WS_PROJECTNAME="${CIRRUS_REPO_FULL_NAME} ${SHORT_VERSION}" | ||
export WS_PROJECTVERSION=${SHORT_VERSION} | ||
ws_scan.sh -c build/whitesource/wss-unified-agent.config | ||
allow_failures: true | ||
always: | ||
ws_artifacts: | ||
path: "whitesource/**/*" | ||
|
||
promote_task: | ||
ec2_instance: *INSTANCE_DEFINITION | ||
only_if: $CIRRUS_USER_COLLABORATOR == "true" && $CIRRUS_TAG == "" && ($CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_BRANCH =~ "branch-.*") | ||
depends_on: | ||
- build | ||
env: | ||
ARTIFACTORY_PROMOTE_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token] | ||
GITHUB_TOKEN: VAULT[development/github/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promotion token] | ||
calculate_version_script: *CALCULATE_VERSION_SCRIPT_DEFINITION | ||
promote_script: | | ||
jf config add repox --artifactory-url ${ARTIFACTORY_URL} --access-token "${ARTIFACTORY_PROMOTE_ACCESS_TOKEN}" | ||
jf rt bpr --status "it-passed" "${CIRRUS_REPO_NAME}" "${CI_BUILD_NUMBER}" "sonarsource-public-builds" | ||
source cirrus-env PROMOTE | ||
github-notify-promotion |