File tree Expand file tree Collapse file tree 9 files changed +31
-32
lines changed
Expand file tree Collapse file tree 9 files changed +31
-32
lines changed Original file line number Diff line number Diff line change 2929 steps :
3030 - checkout
3131 - cloudsmith-circleci/authenticate_with_oidc :
32- service_identifier : " circleci-orb-testing"
32+ service_account : " circleci-orb-testing"
3333 - run :
3434 name : Assert environment variables have been set
3535 command : |
3838 echo "Test failed: CLOUDSMITH_ORGANISATION has not been set correctly."
3939 exit 1
4040 fi
41- if [ $CLOUDSMITH_SERVICE_IDENTIFIER != "circleci-orb-testing" ]
41+ if [ $CLOUDSMITH_SERVICE_ACCOUNT != "circleci-orb-testing" ]
4242 then
43- echo "Test failed: CLOUDSMITH_SERVICE_IDENTIFIER has not been set."
43+ echo "Test failed: CLOUDSMITH_SERVICE_ACCOUNT has not been set."
4444 exit 1
4545 fi
4646 if [ -z $CLOUDSMITH_OIDC_TOKEN ]
5656 steps :
5757 - checkout
5858 - cloudsmith-circleci/set_env_vars_for_pip :
59- repository_identifier : " circleci-orb-testing"
60- service_identifier : " circleci-orb-testing"
59+ repository : " circleci-orb-testing"
60+ service_account : " circleci-orb-testing"
6161 - run :
6262 name : Assert environment variables have been set
6363 command : |
Original file line number Diff line number Diff line change @@ -10,10 +10,9 @@ A CircleCI orb to assist with downloading from and publishing packages to Clouds
1010
1111The orb commands need the following parameters:
1212
13- * ` repository_identifier ` : The identity/slug of the Cloudsmith repository
13+ * ` repository ` : The identity/slug of the Cloudsmith repository
1414
15-
16- * ` service_identifier ` : The identity/slug of the Cloudsmith service account to use when authenticating with OIDC
15+ * ` service_account ` : The identity/slug of the Cloudsmith service account to use when authenticating with OIDC
1716
1817This can be found in the [ Cloudsmith UI] ( https://cloudsmith.io/orgs/financial-times/ ) .
1918
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ description:
22 Utility command to authenticate with Cloudsmith using OpenID Connect (OIDC) and if successful generate a short-lived
33 OIDC token for use in subsequent requests to cloudsmith. The token is valid for up to 2 hours.
44
5- The environment variables CLOUDSMITH_SERVICE_IDENTIFIER and CLOUDSMITH_OIDC_TOKEN are set.
5+ The environment variables CLOUDSMITH_SERVICE_ACCOUNT and CLOUDSMITH_OIDC_TOKEN are set.
66parameters :
7- service_identifier :
7+ service_account :
88 description : The identity/slug of the Cloudsmith service account to use when authenticating
99 type : string
1010steps :
1818 - run :
1919 name : Configure Cloudsmith service account
2020 command : |
21- echo "export CLOUDSMITH_SERVICE_IDENTIFIER =\"<<parameters.service_identifier >>\"" >> "$BASH_ENV"
21+ echo "export CLOUDSMITH_SERVICE_ACCOUNT =\"<<parameters.service_account >>\"" >> "$BASH_ENV"
2222 - run :
2323 name : Authenticate with OIDC
2424 command : <<include(scripts/authenticate_with_oidc.sh)>>
Original file line number Diff line number Diff line change 11description :
22 Authenticates to Cloudsmith and generates a pip index url string which is assigned to the CLOUDSMITH_PIP_INDEX_URL environment variable.
33parameters :
4- repository_identifier :
4+ repository :
55 description : The identity/slug of the Cloudsmith repository
66 type : string
7- service_identifier :
7+ service_account :
88 description : The identity/slug of the Cloudsmith service account to use when authenticating with OIDC
99 type : string
1010steps :
1111 - authenticate_with_oidc :
12- service_identifier : <<parameters.service_identifier >>
12+ service_account : <<parameters.service_account >>
1313 - run :
1414 name : Configure Cloudsmith domains
1515 command : <<include(scripts/configure_cloudsmith_domains.sh)>>
1616 - run :
1717 name : Configure Cloudsmith repository
1818 command : |
19- echo "export CLOUDSMITH_REPOSITORY_IDENTIFIER =\"<<parameters.repository_identifier >>\"" >> $BASH_ENV
20- echo "CLOUDSMITH_REPOSITORY_IDENTIFIER =<<parameters.repository_identifier >>"
19+ echo "export CLOUDSMITH_REPOSITORY =\"<<parameters.repository >>\"" >> $BASH_ENV
20+ echo "CLOUDSMITH_REPOSITORY =<<parameters.repository >>"
2121 - run :
2222 name : Set environment variables for pip
2323 command : <<include(scripts/set_env_vars_for_pip.sh)>>
Original file line number Diff line number Diff line change 1111 steps :
1212 - checkout
1313 - ft-cloudsmith/set_env_vars_for_pip :
14- repository_identifier : " your-repository-identifier "
15- service_identifier : " your-service-identifier "
14+ repository : " your-repository-id "
15+ service_account : " your-service-account-id "
1616 - run : python -m pip config set global.index-url "$CLOUDSMITH_PIP_INDEX_URL"
1717 - run : python -m pip install -r requirements.txt
1818 workflows :
Original file line number Diff line number Diff line change 1111 steps :
1212 - checkout
1313 - ft-cloudsmith/set_env_vars_for_pip :
14- repository_identifier : " your-repository-identifier "
15- service_identifier : " your-service-identifier "
14+ repository : " your-repository-id "
15+ service_account : " your-service-account-id "
1616 - run : python -m pip install your-package==0.0.0 --index-url "$CLOUDSMITH_PIP_INDEX_URL"
1717 workflows :
1818 main :
Original file line number Diff line number Diff line change 1111 steps :
1212 - checkout
1313 - ft-cloudsmith/set_env_vars_for_pip :
14- repository_identifier : " your-repository-identifier "
15- service_identifier : " your-service-identifier "
14+ repository : " your-repository-id "
15+ service_account : " your-service-account-id "
1616 - run : python -m pip install -r requirements.txt --index-url "$CLOUDSMITH_PIP_INDEX_URL"
1717 workflows :
1818 main :
Original file line number Diff line number Diff line change 1111 exit 1
1212fi
1313
14- if [ -z " $CLOUDSMITH_SERVICE_IDENTIFIER " ]
14+ if [ -z " $CLOUDSMITH_SERVICE_ACCOUNT " ]
1515then
16- echo " Unable to generate OIDC token. Environment variable CLOUDSMITH_SERVICE_IDENTIFIER is not set."
16+ echo " Unable to generate OIDC token. Environment variable CLOUDSMITH_SERVICE_ACCOUNT is not set."
1717 exit 1
1818fi
1919
20- echo " Generating Cloudsmith OIDC token for service account: $CLOUDSMITH_ORGANISATION /$CLOUDSMITH_SERVICE_IDENTIFIER "
20+ echo " Generating Cloudsmith OIDC token for service account: $CLOUDSMITH_ORGANISATION /$CLOUDSMITH_SERVICE_ACCOUNT "
2121
2222RESPONSE=$( curl -X POST -H " Content-Type: application/json" \
23- -d " {\" oidc_token\" :\" $CIRCLE_OIDC_TOKEN_V2 \" , \" service_slug\" :\" $CLOUDSMITH_SERVICE_IDENTIFIER \" }" \
23+ -d " {\" oidc_token\" :\" $CIRCLE_OIDC_TOKEN_V2 \" , \" service_slug\" :\" $CLOUDSMITH_SERVICE_ACCOUNT \" }" \
2424 --silent --show-error " https://api.cloudsmith.io/openid/$CLOUDSMITH_ORGANISATION /" )
2525
2626CLOUDSMITH_OIDC_TOKEN=$( echo " $RESPONSE " | grep -o ' "token": "[^"]*' | grep -o ' [^"]*$' )
3939
4040 echo " The following environment variables have been exported. The OIDC token has been masked below."
4141 echo " "
42- echo " CLOUDSMITH_SERVICE_IDENTIFIER= $CLOUDSMITH_SERVICE_IDENTIFIER "
42+ echo " CLOUDSMITH_SERVICE_ACCOUNT= $CLOUDSMITH_SERVICE_ACCOUNT "
4343 echo " CLOUDSMITH_OIDC_TOKEN=********"
4444fi
Original file line number Diff line number Diff line change 55
66set +e
77
8- if [ -z " $CLOUDSMITH_SERVICE_IDENTIFIER " ] || [ -z " $CLOUDSMITH_OIDC_TOKEN " ]
8+ if [ -z " $CLOUDSMITH_SERVICE_ACCOUNT " ] || [ -z " $CLOUDSMITH_OIDC_TOKEN " ]
99then
1010 echo " Unable to find an OIDC token to use. Please ensure the authenticate_with_oidc command has been run before this command."
1111 exit 1
1212fi
1313
14- if [ -z " $CLOUDSMITH_REPOSITORY_IDENTIFIER " ]
14+ if [ -z " $CLOUDSMITH_REPOSITORY " ]
1515then
16- echo " Unable to set environment variables for pip. Env var CLOUDSMITH_REPOSITORY_IDENTIFIER is not defined."
16+ echo " Unable to set environment variables for pip. Env var CLOUDSMITH_REPOSITORY is not defined."
1717 exit 1
1818fi
1919
2424fi
2525
2626
27- CLOUDSMITH_PIP_INDEX_URL=" https://$CLOUDSMITH_SERVICE_IDENTIFIER :$CLOUDSMITH_OIDC_TOKEN @$CLOUDSMITH_DOWNLOADS_DOMAIN /basic/$CLOUDSMITH_REPOSITORY_IDENTIFIER /python/simple/"
27+ CLOUDSMITH_PIP_INDEX_URL=" https://$CLOUDSMITH_SERVICE_ACCOUNT :$CLOUDSMITH_OIDC_TOKEN @$CLOUDSMITH_DOWNLOADS_DOMAIN /basic/$CLOUDSMITH_REPOSITORY /python/simple/"
2828
2929echo " export CLOUDSMITH_PIP_INDEX_URL=\" $CLOUDSMITH_PIP_INDEX_URL \" " >> " $BASH_ENV "
3030
3131echo " The following environment variables have been exported. Note, the OIDC token has been masked below."
3232echo " "
33- echo " CLOUDSMITH_PIP_INDEX_URL=https://$CLOUDSMITH_SERVICE_IDENTIFIER :********@$CLOUDSMITH_DOWNLOADS_DOMAIN /basic/$CLOUDSMITH_REPOSITORY_IDENTIFIER /python/simple/"
33+ echo " CLOUDSMITH_PIP_INDEX_URL=https://$CLOUDSMITH_SERVICE_ACCOUNT :********@$CLOUDSMITH_DOWNLOADS_DOMAIN /basic/$CLOUDSMITH_REPOSITORY /python/simple/"
You can’t perform that action at this time.
0 commit comments