You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
modules/jfrog-oauth
Michael Smith 438c904567
chore: cleanup all test files (#293)
## Changes made
- Removed all unused imports, and made sure type imports were labeled
correctly
- Updated all comparisons to be more strict
- Simplified loops to remove unneeded closure functions
- Removed all explicit `any` types
- Updated how strings were defined to follow general TypeScript best
practices

## Notes
- We definitely want some kind of linting setup for this repo. I'm going
to bring this up when Blueberry has its next team meeting next week
7 months ago
..
.npmrc.tftpl feat(jfrog): support multiple repositories (#289) 7 months ago
README.md feat(jfrog): support multiple repositories (#289) 7 months ago
main.test.ts chore: cleanup all test files (#293) 7 months ago
main.tf feat(jfrog): support multiple repositories (#289) 7 months ago
pip.conf.tftpl feat(jfrog): support multiple repositories (#289) 7 months ago
run.sh feat(jfrog): support multiple repositories (#289) 7 months ago

README.md

display_name description icon maintainer_github partner_github verified tags
JFrog (OAuth) Install the JF CLI and authenticate with Artifactory using OAuth. ../.icons/jfrog.svg coder jfrog true
integration
jfrog

JFrog

Install the JF CLI and authenticate package managers with Artifactory using OAuth configured via the Coder external-auth feature.

JFrog OAuth

module "jfrog" {
  source         = "registry.coder.com/modules/jfrog-oauth/coder"
  version        = "1.0.19"
  agent_id       = coder_agent.example.id
  jfrog_url      = "https://example.jfrog.io"
  username_field = "username" # If you are using GitHub to login to both Coder and Artifactory, use username_field = "username"

  package_managers = {
    npm    = ["npm", "@scoped:npm-scoped"]
    go     = ["go", "another-go-repo"]
    pypi   = ["pypi", "extra-index-pypi"]
    docker = ["example-docker-staging.jfrog.io", "example-docker-production.jfrog.io"]
  }
}

Note This module does not install npm, go, pip, etc but only configure them. You need to handle the installation of these tools yourself.

Prerequisites

This module is usable by JFrog self-hosted (on-premises) Artifactory as it requires configuring a custom integration. This integration benefits from Coder's external-auth feature and allows each user to authenticate with Artifactory using an OAuth flow and issues user-scoped tokens to each user. For configuration instructions, see this guide on the Coder documentation.

Examples

Configure the Python pip package manager to fetch packages from Artifactory while mapping the Coder email to the Artifactory username.

module "jfrog" {
  source         = "registry.coder.com/modules/jfrog-oauth/coder"
  version        = "1.0.19"
  agent_id       = coder_agent.example.id
  jfrog_url      = "https://example.jfrog.io"
  username_field = "email"

  package_managers = {
    pypi = ["pypi"]
  }
}

You should now be able to install packages from Artifactory using both the jf pip and pip command.

jf pip install requests
pip install requests

Configure code-server with JFrog extension

The JFrog extension for VS Code allows you to interact with Artifactory from within the IDE.

module "jfrog" {
  source                = "registry.coder.com/modules/jfrog-oauth/coder"
  version               = "1.0.19"
  agent_id              = coder_agent.example.id
  jfrog_url             = "https://example.jfrog.io"
  username_field        = "username" # If you are using GitHub to login to both Coder and Artifactory, use username_field = "username"
  configure_code_server = true       # Add JFrog extension configuration for code-server
  package_managers = {
    npm  = ["npm"]
    go   = ["go"]
    pypi = ["pypi"]
  }
}

Using the access token in other terraform resources

JFrog Access token is also available as a terraform output. You can use it in other terraform resources. For example, you can use it to configure an Artifactory docker registry with the docker terraform provider.

provider "docker" {
  # ...
  registry_auth {
    address  = "https://example.jfrog.io/artifactory/api/docker/REPO-KEY"
    username = module.jfrog.username
    password = module.jfrog.access_token
  }
}

Here REPO_KEY is the name of docker repository in Artifactory.