Skip to content

Commit 335ac66

Browse files
committed
SCANPY-202 Enable IRIS issue propagation to SQC-EU/US
1 parent 775dbe8 commit 335ac66

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

.cirrus.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
env:
22
ARTIFACTORY_URL: VAULT[development/kv/data/repox data.url]
3+
ARTIFACTORY_PRIVATE_USERNAME: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader
34
ARTIFACTORY_PRIVATE_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
45
ARTIFACTORY_DEPLOY_USERNAME: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer username]
56
ARTIFACTORY_DEPLOY_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer access_token]
@@ -312,3 +313,23 @@ promote_task:
312313
<<: *POETRY_INSTALL
313314
<<: *POETRY_SET_VERSION
314315
promote_script: cirrus_promote
316+
317+
run_iris_task:
318+
depends_on:
319+
- promote
320+
<<: *LINUX_CONTAINER_DEFINITION
321+
# only executed in CRON job AND on master branch
322+
only_if: $CIRRUS_CRON == $CRON_NIGHTLY_JOB_NAME && $CIRRUS_BRANCH == "master"
323+
env:
324+
SONAR_SOURCE_IRIS_TOKEN: VAULT[development/kv/data/iris data.next]
325+
matrix:
326+
- name: "IRIS SQ NEXT -> Sonarcloud.io"
327+
env:
328+
SONAR_TARGET_URL: https://sonarcloud.io
329+
SONAR_TARGET_IRIS_TOKEN: VAULT[development/kv/data/iris data.sqc-eu]
330+
- name: "IRIS SQ NEXT -> SonarQube.us"
331+
env:
332+
SONAR_TARGET_URL: https://sonarqube.us
333+
SONAR_TARGET_IRIS_TOKEN: VAULT[development/kv/data/iris data.sqc-us]
334+
script:
335+
- .cirrus/run_iris.sh

.cirrus/run_iris.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
: "${ARTIFACTORY_PRIVATE_USERNAME?}" "${ARTIFACTORY_PRIVATE_ACCESS_TOKEN?}" "${ARTIFACTORY_URL?}"
5+
: "${SONAR_SOURCE_IRIS_TOKEN?}" "${SONAR_TARGET_IRIS_TOKEN?}" "${SONAR_TARGET_URL?}"
6+
7+
function run_iris () {
8+
java \
9+
-Diris.source.projectKey="SonarSource_sonar-scanner-python" \
10+
-Diris.source.url="https://next.sonarqube.com/sonarqube" \
11+
-Diris.source.token="$SONAR_SOURCE_IRIS_TOKEN" \
12+
-Diris.destination.projectKey="SonarSource_sonar-scanner-python" \
13+
-Diris.destination.url="$SONAR_TARGET_URL" \
14+
-Diris.destination.token="$SONAR_TARGET_IRIS_TOKEN" \
15+
-Diris.destination.organization="sonarsource" \
16+
-Diris.dryrun=$1 \
17+
-jar iris-\[RELEASE\]-jar-with-dependencies.jar
18+
}
19+
20+
VERSION="\[RELEASE\]"
21+
HTTP_CODE=$(\
22+
curl \
23+
--write-out '%{http_code}' \
24+
--location \
25+
--remote-name \
26+
--user "$ARTIFACTORY_PRIVATE_USERNAME:$ARTIFACTORY_PRIVATE_ACCESS_TOKEN" \
27+
"$ARTIFACTORY_URL/sonarsource-private-releases/com/sonarsource/iris/iris/$VERSION/iris-$VERSION-jar-with-dependencies.jar"\
28+
)
29+
30+
if [ "$HTTP_CODE" != "200" ]; then
31+
echo "Download $VERSION failed -> $HTTP_CODE"
32+
exit 1
33+
else
34+
echo "Downloaded $VERSION"
35+
fi
36+
37+
echo "===== Execute IRIS as dry-run"
38+
run_iris "true"
39+
STATUS=$?
40+
if [ $STATUS -ne 0 ]; then
41+
echo "===== Failed to run IRIS dry-run"
42+
exit 1
43+
else
44+
echo "===== Successful IRIS dry-run - executing IRIS for real."
45+
run_iris "false"
46+
fi

0 commit comments

Comments
 (0)