File tree Expand file tree Collapse file tree 5 files changed +57
-23
lines changed
Expand file tree Collapse file tree 5 files changed +57
-23
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ updateRepos $GITLAB_GITOPS
146146# Jenkins
147147# note, jenkins secrets are global so set once"
148148if [ $SKIP_SECRETS == " false" ]; then
149- bash hack/jenkins-set-secrets
149+ bash hack/jenkins-set-variables
150150fi
151151updateRepos $JENKINS_BUILD
152152updateRepos $JENKINS_GITOPS
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ cat << CREDS > $CREDS
1414</org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl>
1515CREDS
1616
17- # cat $CREDS
1817echo " Creating Jenkins credential $SECRET_NAME "
1918java -jar $SCRIPTDIR /jenkins-cli.jar -s $MY_JENKINS_SERVER \
2019 -auth $MY_JENKINS_USER :$MY_JENKINS_TOKEN \
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -euo pipefail
4+
5+ SCRIPTDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd) "
6+
7+ if [ $# -ne 2 ]; then
8+ echo " Invalid number of arguments"
9+ echo
10+ echo " Usage: $0 <key> <value>"
11+ exit 1
12+ fi
13+
14+ key=" $1 "
15+ value=" $2 "
16+
17+ # Define a Groovy script that creates/updates an environment variable
18+ read -r -d ' ' groovy_create_var << EOF
19+ import jenkins.model.*
20+ nodes = Jenkins.instance.globalNodeProperties
21+ nodes.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class)
22+ envVars = nodes[0].envVars
23+ envVars['${key} '] = '"${value} "'
24+ println("Set '${key} ' to: " + envVars['${key} '])
25+ EOF
26+
27+ # Run the Groovy script via Jenkins CLI
28+ java -jar " $SCRIPTDIR /jenkins-cli.jar" \
29+ -s " $MY_JENKINS_SERVER " \
30+ -auth " $MY_JENKINS_USER :$MY_JENKINS_TOKEN " \
31+ groovy = < <( echo " $groovy_create_var " )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ SCRIPTDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd) "
3+
4+ ENV=" MY_JENKINS_SERVER MY_JENKINS_USER MY_JENKINS_TOKEN COSIGN_SECRET_PASSWORD COSIGN_SECRET_KEY COSIGN_PUBLIC_KEY "
5+
6+ ENV+=" ACS__API_TOKEN ACS__CENTRAL_ENDPOINT GITOPS_AUTH_PASSWORD "
7+ source " $SCRIPTDIR /../rhtap/verify-deps-exist" " $ENV " " java "
8+
9+ bash " $SCRIPTDIR /jenkins-create-secret" ROX_API_TOKEN " $ACS__API_TOKEN "
10+ bash " $SCRIPTDIR /jenkins-create-variable" ROX_CENTRAL_ENDPOINT " $ACS__CENTRAL_ENDPOINT "
11+
12+ bash " $SCRIPTDIR /jenkins-create-secret" GITOPS_AUTH_PASSWORD " $GITOPS_AUTH_PASSWORD "
13+
14+ bash " $SCRIPTDIR /jenkins-create-secret" COSIGN_SECRET_PASSWORD " $COSIGN_SECRET_PASSWORD "
15+ bash " $SCRIPTDIR /jenkins-create-secret" COSIGN_SECRET_KEY " $COSIGN_SECRET_KEY "
16+ bash " $SCRIPTDIR /jenkins-create-variable" COSIGN_PUBLIC_KEY " $COSIGN_PUBLIC_KEY "
17+
18+ bash " $SCRIPTDIR /jenkins-create-variable" TRUSTIFICATION_BOMBASTIC_API_URL " $TRUSTIFICATION_BOMBASTIC_API_URL "
19+ bash " $SCRIPTDIR /jenkins-create-variable" TRUSTIFICATION_OIDC_ISSUER_URL " $TRUSTIFICATION_OIDC_ISSUER_URL "
20+ bash " $SCRIPTDIR /jenkins-create-variable" TRUSTIFICATION_OIDC_CLIENT_ID " $TRUSTIFICATION_OIDC_CLIENT_ID "
21+ bash " $SCRIPTDIR /jenkins-create-secret" TRUSTIFICATION_OIDC_CLIENT_SECRET " $TRUSTIFICATION_OIDC_CLIENT_SECRET "
22+ bash " $SCRIPTDIR /jenkins-create-variable" TRUSTIFICATION_SUPPORTED_CYCLONEDX_VERSION " $TRUSTIFICATION_SUPPORTED_CYCLONEDX_VERSION "
23+
24+ bash " $SCRIPTDIR /jenkins-create-user-password" QUAY_IO_CREDS " $MY_QUAY_USER " " $MY_QUAY_PW "
25+
You can’t perform that action at this time.
0 commit comments