-
Notifications
You must be signed in to change notification settings - Fork 386
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
13 changed files
with
415 additions
and
294 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,38 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
echo $SONARSOURCE_SIGN_KEY_PASSPHRASE | gpg --batch --yes --passphrase-fd 0 --import /tmp/key | ||
: "${SONARSOURCE_SIGN_KEY:?}" | ||
: "${SONARSOURCE_SIGN_KEY_ID:?}" | ||
: "${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,10 @@ | ||
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") | ||
return tasks_env + tasks_templates + 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
Oops, something went wrong.