diff --git a/jfrog-oauth/main.test.ts b/jfrog-oauth/main.test.ts index 40ea77b..7e2ab6e 100644 --- a/jfrog-oauth/main.test.ts +++ b/jfrog-oauth/main.test.ts @@ -40,8 +40,12 @@ registry=${fakeFrogUrl}/artifactory/api/npm/global EOF`; expect(coderScript.script).toContain(npmrcStanza); - expect(coderScript.script).toContain('jf npmc --global --repo-resolve "global"'); - expect(coderScript.script).toContain('if [ -z "YES" ]; then\n not_configured npm'); + expect(coderScript.script).toContain( + 'jf npmc --global --repo-resolve "global"', + ); + expect(coderScript.script).toContain( + 'if [ -z "YES" ]; then\n not_configured npm', + ); }); it("generates a pip config with extra-indexes", async () => { @@ -62,8 +66,12 @@ extra-index-url = EOF`; expect(coderScript.script).toContain(pipStanza); - expect(coderScript.script).toContain('jf pipc --global --repo-resolve "global"'); - expect(coderScript.script).toContain('if [ -z "YES" ]; then\n not_configured pypi'); + expect(coderScript.script).toContain( + 'jf pipc --global --repo-resolve "global"', + ); + expect(coderScript.script).toContain( + 'if [ -z "YES" ]; then\n not_configured pypi', + ); }); it("registers multiple docker repos", async () => { @@ -79,7 +87,9 @@ EOF`; register_docker "bar.jfrog.io" register_docker "baz.jfrog.io"`; expect(coderScript.script).toContain(dockerStanza); - expect(coderScript.script).toContain('if [ -z "YES" ]; then\n not_configured docker'); + expect(coderScript.script).toContain( + 'if [ -z "YES" ]; then\n not_configured docker', + ); }); it("sets goproxy with multiple repos", async () => { @@ -93,9 +103,13 @@ register_docker "baz.jfrog.io"`; const proxyEnv = findResourceInstance(state, "coder_env", "goproxy"); const proxies = `https://default:@${fakeFrogHostAndPort}/artifactory/api/go/foo,https://default:@${fakeFrogHostAndPort}/artifactory/api/go/bar,https://default:@${fakeFrogHostAndPort}/artifactory/api/go/baz`; expect(proxyEnv["value"]).toEqual(proxies); - + const coderScript = findResourceInstance(state, "coder_script"); - expect(coderScript.script).toContain('jf goc --global --repo-resolve "foo"'); - expect(coderScript.script).toContain('if [ -z "YES" ]; then\n not_configured go'); + expect(coderScript.script).toContain( + 'jf goc --global --repo-resolve "foo"', + ); + expect(coderScript.script).toContain( + 'if [ -z "YES" ]; then\n not_configured go', + ); }); }); diff --git a/jfrog-oauth/run.sh b/jfrog-oauth/run.sh index ba55395..7d36e47 100644 --- a/jfrog-oauth/run.sh +++ b/jfrog-oauth/run.sh @@ -2,17 +2,17 @@ BOLD='\033[0;1m' -not_configured(){ +not_configured() { type=$1 echo "🤔 no $type repository is set, skipping $type configuration." echo "You can configure a $type repository by providing a key for '$type' in the 'package_managers' input." } -config_complete(){ +config_complete() { echo "🥳 Configuration complete!" } -register_docker(){ +register_docker() { repo=$1 echo -n "${ARTIFACTORY_ACCESS_TOKEN}" | docker login "$repo" --username ${ARTIFACTORY_USERNAME} --password-stdin } diff --git a/jfrog-token/README.md b/jfrog-token/README.md index 172d0c0..652451f 100644 --- a/jfrog-token/README.md +++ b/jfrog-token/README.md @@ -101,7 +101,7 @@ module "jfrog" { artifactory_access_token = var.artifactory_access_token token_description = "Token for Coder workspace: ${data.coder_workspace_owner.me.name}/${data.coder_workspace.me.name}" package_managers = { - npm = ["npm"] + npm = ["npm"] } } ``` diff --git a/jfrog-token/main.test.ts b/jfrog-token/main.test.ts index d71a486..af36710 100644 --- a/jfrog-token/main.test.ts +++ b/jfrog-token/main.test.ts @@ -67,8 +67,12 @@ registry=${fakeFrogUrl}/artifactory/api/npm/global EOF`; expect(coderScript.script).toContain(npmrcStanza); - expect(coderScript.script).toContain('jf npmc --global --repo-resolve "global"'); - expect(coderScript.script).toContain('if [ -z "YES" ]; then\n not_configured npm'); + expect(coderScript.script).toContain( + 'jf npmc --global --repo-resolve "global"', + ); + expect(coderScript.script).toContain( + 'if [ -z "YES" ]; then\n not_configured npm', + ); }); it("generates a pip config with extra-indexes", async () => { @@ -90,8 +94,12 @@ extra-index-url = EOF`; expect(coderScript.script).toContain(pipStanza); - expect(coderScript.script).toContain('jf pipc --global --repo-resolve "global"'); - expect(coderScript.script).toContain('if [ -z "YES" ]; then\n not_configured pypi'); + expect(coderScript.script).toContain( + 'jf pipc --global --repo-resolve "global"', + ); + expect(coderScript.script).toContain( + 'if [ -z "YES" ]; then\n not_configured pypi', + ); }); it("registers multiple docker repos", async () => { @@ -108,7 +116,9 @@ EOF`; register_docker "bar.jfrog.io" register_docker "baz.jfrog.io"`; expect(coderScript.script).toContain(dockerStanza); - expect(coderScript.script).toContain('if [ -z "YES" ]; then\n not_configured docker'); + expect(coderScript.script).toContain( + 'if [ -z "YES" ]; then\n not_configured docker', + ); }); it("sets goproxy with multiple repos", async () => { @@ -123,9 +133,13 @@ register_docker "baz.jfrog.io"`; const proxyEnv = findResourceInstance(state, "coder_env", "goproxy"); const proxies = `https://default:xxx@${fakeFrogHostAndPort}/artifactory/api/go/foo,https://default:xxx@${fakeFrogHostAndPort}/artifactory/api/go/bar,https://default:xxx@${fakeFrogHostAndPort}/artifactory/api/go/baz`; expect(proxyEnv["value"]).toEqual(proxies); - + const coderScript = findResourceInstance(state, "coder_script"); - expect(coderScript.script).toContain('jf goc --global --repo-resolve "foo"'); - expect(coderScript.script).toContain('if [ -z "YES" ]; then\n not_configured go'); + expect(coderScript.script).toContain( + 'jf goc --global --repo-resolve "foo"', + ); + expect(coderScript.script).toContain( + 'if [ -z "YES" ]; then\n not_configured go', + ); }); }); diff --git a/jfrog-token/run.sh b/jfrog-token/run.sh index 4c68ca1..d3a1a74 100644 --- a/jfrog-token/run.sh +++ b/jfrog-token/run.sh @@ -2,17 +2,17 @@ BOLD='\033[0;1m' -not_configured(){ +not_configured() { type=$1 echo "🤔 no $type repository is set, skipping $type configuration." echo "You can configure a $type repository by providing a key for '$type' in the 'package_managers' input." } -config_complete(){ +config_complete() { echo "🥳 Configuration complete!" } -register_docker(){ +register_docker() { repo=$1 echo -n "${ARTIFACTORY_ACCESS_TOKEN}" | docker login "$repo" --username ${ARTIFACTORY_USERNAME} --password-stdin }