Skip to content

Commit a6438f6

Browse files
authored
Rename repository_identifier to repository and service_identifer to service_account (#21)
1 parent 8d31c10 commit a6438f6

File tree

9 files changed

+31
-32
lines changed

9 files changed

+31
-32
lines changed

.circleci/test-deploy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
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: |
@@ -38,9 +38,9 @@ jobs:
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 ]
@@ -56,8 +56,8 @@ jobs:
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: |

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ A CircleCI orb to assist with downloading from and publishing packages to Clouds
1010

1111
The 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

1817
This can be found in the [Cloudsmith UI](https://cloudsmith.io/orgs/financial-times/).
1918

src/commands/authenticate_with_oidc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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.
66
parameters:
7-
service_identifier:
7+
service_account:
88
description: The identity/slug of the Cloudsmith service account to use when authenticating
99
type: string
1010
steps:
@@ -18,7 +18,7 @@ steps:
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)>>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
description:
22
Authenticates to Cloudsmith and generates a pip index url string which is assigned to the CLOUDSMITH_PIP_INDEX_URL environment variable.
33
parameters:
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
1010
steps:
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)>>

src/examples/configure_pip.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ usage:
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:

src/examples/pip_install_package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ usage:
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:

src/examples/pip_install_requirements.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ usage:
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:

src/scripts/authenticate_with_oidc.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ then
1111
exit 1
1212
fi
1313

14-
if [ -z "$CLOUDSMITH_SERVICE_IDENTIFIER" ]
14+
if [ -z "$CLOUDSMITH_SERVICE_ACCOUNT" ]
1515
then
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
1818
fi
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

2222
RESPONSE=$(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

2626
CLOUDSMITH_OIDC_TOKEN=$(echo "$RESPONSE" | grep -o '"token": "[^"]*' | grep -o '[^"]*$')
@@ -39,6 +39,6 @@ else
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=********"
4444
fi

src/scripts/set_env_vars_for_pip.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
set +e
77

8-
if [ -z "$CLOUDSMITH_SERVICE_IDENTIFIER" ] || [ -z "$CLOUDSMITH_OIDC_TOKEN" ]
8+
if [ -z "$CLOUDSMITH_SERVICE_ACCOUNT" ] || [ -z "$CLOUDSMITH_OIDC_TOKEN" ]
99
then
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
1212
fi
1313

14-
if [ -z "$CLOUDSMITH_REPOSITORY_IDENTIFIER" ]
14+
if [ -z "$CLOUDSMITH_REPOSITORY" ]
1515
then
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
1818
fi
1919

@@ -24,10 +24,10 @@ then
2424
fi
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

2929
echo "export CLOUDSMITH_PIP_INDEX_URL=\"$CLOUDSMITH_PIP_INDEX_URL\"" >> "$BASH_ENV"
3030

3131
echo "The following environment variables have been exported. Note, the OIDC token has been masked below."
3232
echo ""
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/"

0 commit comments

Comments
 (0)