Skip to content

Commit cfbebff

Browse files
committed
feat(jfrog): add option to customize server id for JFrog CLI
1 parent ac64af6 commit cfbebff

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

jfrog-token/main.tf

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ variable "jfrog_url" {
2323
}
2424
}
2525

26+
variable "jfrog_server_id" {
27+
type = string
28+
description = "The server ID of the JFrog instance for JFrog CLI confuguration"
29+
default = "0"
30+
}
31+
2632
variable "artifactory_access_token" {
2733
type = string
2834
description = "The admin-level access token to use for JFrog."
@@ -112,6 +118,7 @@ resource "coder_script" "jfrog" {
112118
script = templatefile("${path.module}/run.sh", {
113119
JFROG_URL : var.jfrog_url,
114120
JFROG_HOST : local.jfrog_host,
121+
JFROG_SERVER_ID : var.jfrog_server_id,
115122
ARTIFACTORY_USERNAME : local.username,
116123
ARTIFACTORY_EMAIL : data.coder_workspace.me.owner_email,
117124
ARTIFACTORY_ACCESS_TOKEN : artifactory_scoped_token.me.access_token,

jfrog-token/run.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ fi
1515
# flows.
1616
export CI=true
1717
# Authenticate JFrog CLI with Artifactory.
18-
echo "${ARTIFACTORY_ACCESS_TOKEN}" | jf c add --access-token-stdin --url "${JFROG_URL}" --overwrite 0
18+
echo "${ARTIFACTORY_ACCESS_TOKEN}" | jf c add --access-token-stdin --url "${JFROG_URL}" --overwrite "${JFROG_SERVER_ID}"
1919
# Set the configured server as the default.
20-
jf c use 0
20+
jf c use "${JFROG_SERVER_ID}"
2121

2222
# Configure npm to use the Artifactory "npm" repository.
2323
if [ -z "${REPOSITORY_NPM}" ]; then

0 commit comments

Comments
 (0)