-
Notifications
You must be signed in to change notification settings - Fork 389
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
Showing
14 changed files
with
429 additions
and
306 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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
load("github.com/SonarSource/cirrus-modules@v3", "load_features") | ||
load("cirrus", "env", "fs", "yaml") | ||
load(".cirrus/tasks.star", "build_tasks") | ||
|
||
|
||
def main(ctx): | ||
return yaml.dumps(load_features(ctx)) + fs.read(".cirrus/tasks.yml") | ||
tasks = build_tasks(ctx) | ||
return yaml.dumps(load_features(ctx)) + tasks |
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
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 |
---|---|---|
@@ -1,13 +1,36 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
echo $SONARSOURCE_SIGN_KEY_PASSPHRASE | gpg --batch --yes --passphrase-fd 0 --import /tmp/key | ||
: "${SONARSOURCE_SIGN_KEY_PASSPHRASE:?}" | ||
: "${CIRRUS_WORKING_DIR:?}" | ||
|
||
CURRENT_DIR=$(pwd) | ||
# If there is a $1 argument, treat it as the chart to sign by looking for $1*.tgz* files | ||
# Otherwise, look for all *.tgz* files in the working directory | ||
CHART_TO_SIGN=${1:-} | ||
NAME_GLOB="*.tgz*" | ||
if [[ -n "${CHART_TO_SIGN}" ]]; then | ||
NAME_GLOB="${CHART_TO_SIGN}-[0-9]*.tgz*" | ||
fi | ||
|
||
for chart in $(find $CIRRUS_WORKING_DIR -maxdepth 1 -name "*.tgz*" -type f -exec basename "{}" ";"); do | ||
cd $CIRRUS_WORKING_DIR | ||
echo $SONARSOURCE_SIGN_KEY_PASSPHRASE | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --output $chart.asc --detach-sig $chart | ||
cd $CURRENT_DIR | ||
done | ||
find_charts=$(find "${CIRRUS_WORKING_DIR}" -maxdepth 1 -name "${NAME_GLOB}" -type f -exec basename "{}" ";" || exit 1) | ||
|
||
CHART_TO_SIGN=() | ||
while IFS= read -r chart; do | ||
CHART_TO_SIGN+=("${chart}") | ||
done <<< "${find_charts}" | ||
|
||
if [[ ${#CHART_TO_SIGN[@]} -eq 0 ]]; then | ||
echo "No charts found to sign." | ||
exit 1 | ||
fi | ||
|
||
# Debugging: Print the charts to be signed | ||
echo "Charts to sign: ${CHART_TO_SIGN[*]}" | ||
|
||
echo "${SONARSOURCE_SIGN_KEY_PASSPHRASE}" | gpg --batch --yes --passphrase-fd 0 --import /tmp/key | ||
|
||
for chart in "${CHART_TO_SIGN[@]}"; do | ||
echo "Signing ${chart}" | ||
echo "${SONARSOURCE_SIGN_KEY_PASSPHRASE}" | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --output "${chart}.asc" --detach-sig "${chart}" | ||
done |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("cirrus", "fs") | ||
|
||
|
||
def build_tasks(ctx): | ||
tasks_env = fs.read(".cirrus/tasks_env.yml") | ||
tasks_templates = fs.read(".cirrus/tasks_templates.yml") | ||
tasks = fs.read(".cirrus/tasks.yml") | ||
tasks += fs.read(".cirrus/tasks_sonarqube.yml") | ||
tasks += fs.read(".cirrus/tasks_sonarqube_dce.yml") | ||
tasks += fs.read(".cirrus/tasks_gcp_marketplace.yml") | ||
|
||
# The release task depends on some sonarqube and sonarqube_dce tasks, | ||
# therefore it MUST be loaded AFTER tasks_sonarqube.yml and tasks_sonarqube_dce.yml | ||
tasks += fs.read(".cirrus/tasks_release.yml") | ||
|
||
return tasks_env + tasks_templates + tasks |
Oops, something went wrong.