Skip to content

Commit 5419676

Browse files
authored
Merge branch 'main' into atif/validate-readme-source
2 parents 7e94395 + 9e47369 commit 5419676

File tree

11 files changed

+122
-14
lines changed

11 files changed

+122
-14
lines changed

registry/coder-labs/modules/sourcegraph-amp/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
display_name: Amp CLI
33
icon: ../../../../.icons/sourcegraph-amp.svg
44
description: Sourcegraph's AI coding agent with deep codebase understanding and intelligent code search capabilities
5-
verified: false
5+
verified: true
66
tags: [agent, sourcegraph, amp, ai, tasks]
77
---
88

@@ -13,7 +13,7 @@ Run [Amp CLI](https://ampcode.com/) in your workspace to access Sourcegraph's AI
1313
```tf
1414
module "amp-cli" {
1515
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
16-
version = "1.0.2"
16+
version = "1.0.3"
1717
agent_id = coder_agent.example.id
1818
sourcegraph_amp_api_key = var.sourcegraph_amp_api_key
1919
install_sourcegraph_amp = true
@@ -60,7 +60,7 @@ variable "sourcegraph_amp_api_key" {
6060
module "amp-cli" {
6161
count = data.coder_workspace.me.start_count
6262
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
63-
version = "1.0.2"
63+
version = "1.0.3"
6464
agent_id = coder_agent.example.id
6565
sourcegraph_amp_api_key = var.sourcegraph_amp_api_key # recommended for authenticated usage
6666
install_sourcegraph_amp = true

registry/coder/modules/jfrog-oauth/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Install the JF CLI and authenticate package managers with Artifactory using OAut
1616
module "jfrog" {
1717
count = data.coder_workspace.me.start_count
1818
source = "registry.coder.com/coder/jfrog-oauth/coder"
19-
version = "1.0.31"
19+
version = "1.1.0"
2020
agent_id = coder_agent.example.id
2121
jfrog_url = "https://example.jfrog.io"
2222
username_field = "username" # If you are using GitHub to login to both Coder and Artifactory, use username_field = "username"
@@ -26,6 +26,7 @@ module "jfrog" {
2626
go = ["go", "another-go-repo"]
2727
pypi = ["pypi", "extra-index-pypi"]
2828
docker = ["example-docker-staging.jfrog.io", "example-docker-production.jfrog.io"]
29+
conda = ["conda", "conda-local"]
2930
}
3031
}
3132
```
@@ -45,7 +46,7 @@ Configure the Python pip package manager to fetch packages from Artifactory whil
4546
module "jfrog" {
4647
count = data.coder_workspace.me.start_count
4748
source = "registry.coder.com/coder/jfrog-oauth/coder"
48-
version = "1.0.31"
49+
version = "1.1.0"
4950
agent_id = coder_agent.example.id
5051
jfrog_url = "https://example.jfrog.io"
5152
username_field = "email"
@@ -74,7 +75,7 @@ The [JFrog extension](https://open-vsx.org/extension/JFrog/jfrog-vscode-extensio
7475
module "jfrog" {
7576
count = data.coder_workspace.me.start_count
7677
source = "registry.coder.com/coder/jfrog-oauth/coder"
77-
version = "1.0.31"
78+
version = "1.1.0"
7879
agent_id = coder_agent.example.id
7980
jfrog_url = "https://example.jfrog.io"
8081
username_field = "username" # If you are using GitHub to login to both Coder and Artifactory, use username_field = "username"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
channels:
2+
%{ for REPO in REPOS ~}
3+
- https://${ARTIFACTORY_USERNAME}:${ARTIFACTORY_ACCESS_TOKEN}@${JFROG_HOST}/artifactory/api/conda/${REPO}
4+
%{ endfor ~}
5+
- defaults
6+
ssl_verify: true

registry/coder/modules/jfrog-oauth/main.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,28 @@ EOF`;
126126
'if [ -z "YES" ]; then\n not_configured go',
127127
);
128128
});
129+
130+
it("generates a conda config with multiple repos", async () => {
131+
const state = await runTerraformApply<TestVariables>(import.meta.dir, {
132+
agent_id: "some-agent-id",
133+
jfrog_url: fakeFrogUrl,
134+
package_managers: JSON.stringify({
135+
conda: ["conda-main", "conda-secondary", "conda-local"],
136+
}),
137+
});
138+
const coderScript = findResourceInstance(state, "coder_script");
139+
const condaStanza = `cat << EOF > ~/.condarc
140+
channels:
141+
- https://${user}:@${fakeFrogApi}/conda/conda-main
142+
- https://${user}:@${fakeFrogApi}/conda/conda-secondary
143+
- https://${user}:@${fakeFrogApi}/conda/conda-local
144+
- defaults
145+
ssl_verify: true
146+
147+
EOF`;
148+
expect(coderScript.script).toContain(condaStanza);
149+
expect(coderScript.script).toContain(
150+
'if [ -z "YES" ]; then\n not_configured conda',
151+
);
152+
});
129153
});

registry/coder/modules/jfrog-oauth/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ variable "package_managers" {
5858
go = optional(list(string), [])
5959
pypi = optional(list(string), [])
6060
docker = optional(list(string), [])
61+
conda = optional(list(string), [])
6162
})
6263
description = <<-EOF
6364
A map of package manager names to their respective artifactory repositories. Unused package managers can be omitted.
@@ -67,6 +68,7 @@ variable "package_managers" {
6768
go = ["YOUR_GO_REPO_KEY", "ANOTHER_GO_REPO_KEY"]
6869
pypi = ["YOUR_PYPI_REPO_KEY", "ANOTHER_PYPI_REPO_KEY"]
6970
docker = ["YOUR_DOCKER_REPO_KEY", "ANOTHER_DOCKER_REPO_KEY"]
71+
conda = ["YOUR_CONDA_REPO_KEY", "ANOTHER_CONDA_REPO_KEY"]
7072
}
7173
EOF
7274
}
@@ -98,6 +100,9 @@ locals {
98100
pip_conf = templatefile(
99101
"${path.module}/pip.conf.tftpl", merge(local.common_values, { REPOS = var.package_managers.pypi })
100102
)
103+
conda_conf = templatefile(
104+
"${path.module}/conda.conf.tftpl", merge(local.common_values, { REPOS = var.package_managers.conda })
105+
)
101106
}
102107

103108
data "coder_workspace" "me" {}
@@ -125,6 +130,9 @@ resource "coder_script" "jfrog" {
125130
REPOSITORY_PYPI = try(element(var.package_managers.pypi, 0), "")
126131
HAS_DOCKER = length(var.package_managers.docker) == 0 ? "" : "YES"
127132
REGISTER_DOCKER = join("\n", formatlist("register_docker \"%s\"", var.package_managers.docker))
133+
HAS_CONDA = length(var.package_managers.conda) == 0 ? "" : "YES"
134+
CONDA_CONF = local.conda_conf
135+
REPOSITORY_CONDA = try(element(var.package_managers.conda, 0), "")
128136
}
129137
))
130138
run_on_start = true

registry/coder/modules/jfrog-oauth/run.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ else
8181
fi
8282
fi
8383

84+
# Configure conda to use the Artifactory "conda" repository.
85+
if [ -z "${HAS_CONDA}" ]; then
86+
not_configured conda
87+
else
88+
echo "🐍 Configuring conda..."
89+
# Create conda config directory if it doesn't exist
90+
mkdir -p ~/.conda
91+
cat << EOF > ~/.condarc
92+
${CONDA_CONF}
93+
EOF
94+
config_complete
95+
fi
96+
8497
# Install the JFrog vscode extension for code-server.
8598
if [ "${CONFIGURE_CODE_SERVER}" == "true" ]; then
8699
while ! [ -x /tmp/code-server/bin/code-server ]; do

registry/coder/modules/jfrog-token/README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Install the JF CLI and authenticate package managers with Artifactory using Arti
1313
```tf
1414
module "jfrog" {
1515
source = "registry.coder.com/coder/jfrog-token/coder"
16-
version = "1.0.31"
16+
version = "1.1.0"
1717
agent_id = coder_agent.example.id
1818
jfrog_url = "https://XXXX.jfrog.io"
1919
artifactory_access_token = var.artifactory_access_token
@@ -22,6 +22,7 @@ module "jfrog" {
2222
go = ["go", "another-go-repo"]
2323
pypi = ["pypi", "extra-index-pypi"]
2424
docker = ["example-docker-staging.jfrog.io", "example-docker-production.jfrog.io"]
25+
conda = ["conda", "conda-local"]
2526
}
2627
}
2728
```
@@ -40,30 +41,33 @@ For detailed instructions, please see this [guide](https://coder.com/docs/v2/lat
4041
```tf
4142
module "jfrog" {
4243
source = "registry.coder.com/coder/jfrog-token/coder"
43-
version = "1.0.31"
44+
version = "1.1.0"
4445
agent_id = coder_agent.example.id
4546
jfrog_url = "https://YYYY.jfrog.io"
4647
artifactory_access_token = var.artifactory_access_token # An admin access token
4748
package_managers = {
48-
npm = ["npm-local"]
49-
go = ["go-local"]
50-
pypi = ["pypi-local"]
49+
npm = ["npm-local"]
50+
go = ["go-local"]
51+
pypi = ["pypi-local"]
52+
conda = ["conda-local"]
5153
}
5254
}
5355
```
5456

55-
You should now be able to install packages from Artifactory using both the `jf npm`, `jf go`, `jf pip` and `npm`, `go`, `pip` commands.
57+
You should now be able to install packages from Artifactory using both the `jf npm`, `jf go`, `jf pip` and `npm`, `go`, `pip`, `conda` commands.
5658

5759
```shell
5860
jf npm install prettier
5961
jf go get github.com/golang/example/hello
6062
jf pip install requests
63+
conda install numpy
6164
```
6265

6366
```shell
6467
npm install prettier
6568
go get github.com/golang/example/hello
6669
pip install requests
70+
conda install numpy
6771
```
6872

6973
### Configure code-server with JFrog extension
@@ -73,7 +77,7 @@ The [JFrog extension](https://open-vsx.org/extension/JFrog/jfrog-vscode-extensio
7377
```tf
7478
module "jfrog" {
7579
source = "registry.coder.com/coder/jfrog-token/coder"
76-
version = "1.0.31"
80+
version = "1.1.0"
7781
agent_id = coder_agent.example.id
7882
jfrog_url = "https://XXXX.jfrog.io"
7983
artifactory_access_token = var.artifactory_access_token
@@ -93,7 +97,7 @@ data "coder_workspace" "me" {}
9397
9498
module "jfrog" {
9599
source = "registry.coder.com/coder/jfrog-token/coder"
96-
version = "1.0.31"
100+
version = "1.1.0"
97101
agent_id = coder_agent.example.id
98102
jfrog_url = "https://XXXX.jfrog.io"
99103
artifactory_access_token = var.artifactory_access_token
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
channels:
2+
%{ for REPO in REPOS ~}
3+
- https://${ARTIFACTORY_USERNAME}:${ARTIFACTORY_ACCESS_TOKEN}@${JFROG_HOST}/artifactory/api/conda/${REPO}
4+
%{ endfor ~}
5+
- defaults
6+
ssl_verify: true

registry/coder/modules/jfrog-token/main.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,29 @@ EOF`;
162162
'if [ -z "YES" ]; then\n not_configured go',
163163
);
164164
});
165+
166+
it("generates a conda config with multiple repos", async () => {
167+
const state = await runTerraformApply<TestVariables>(import.meta.dir, {
168+
agent_id: "some-agent-id",
169+
jfrog_url: fakeFrogUrl,
170+
artifactory_access_token: "XXXX",
171+
package_managers: JSON.stringify({
172+
conda: ["conda-main", "conda-secondary", "conda-local"],
173+
}),
174+
});
175+
const coderScript = findResourceInstance(state, "coder_script");
176+
const condaStanza = `cat << EOF > ~/.condarc
177+
channels:
178+
- https://${user}:${token}@${fakeFrogApi}/conda/conda-main
179+
- https://${user}:${token}@${fakeFrogApi}/conda/conda-secondary
180+
- https://${user}:${token}@${fakeFrogApi}/conda/conda-local
181+
- defaults
182+
ssl_verify: true
183+
184+
EOF`;
185+
expect(coderScript.script).toContain(condaStanza);
186+
expect(coderScript.script).toContain(
187+
'if [ -z "YES" ]; then\n not_configured conda',
188+
);
189+
});
165190
});

registry/coder/modules/jfrog-token/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ variable "package_managers" {
9191
go = optional(list(string), [])
9292
pypi = optional(list(string), [])
9393
docker = optional(list(string), [])
94+
conda = optional(list(string), [])
9495
})
9596
description = <<-EOF
9697
A map of package manager names to their respective artifactory repositories. Unused package managers can be omitted.
@@ -100,6 +101,7 @@ variable "package_managers" {
100101
go = ["YOUR_GO_REPO_KEY", "ANOTHER_GO_REPO_KEY"]
101102
pypi = ["YOUR_PYPI_REPO_KEY", "ANOTHER_PYPI_REPO_KEY"]
102103
docker = ["YOUR_DOCKER_REPO_KEY", "ANOTHER_DOCKER_REPO_KEY"]
104+
conda = ["YOUR_CONDA_REPO_KEY", "ANOTHER_CONDA_REPO_KEY"]
103105
}
104106
EOF
105107
}
@@ -131,6 +133,9 @@ locals {
131133
pip_conf = templatefile(
132134
"${path.module}/pip.conf.tftpl", merge(local.common_values, { REPOS = var.package_managers.pypi })
133135
)
136+
conda_conf = templatefile(
137+
"${path.module}/conda.conf.tftpl", merge(local.common_values, { REPOS = var.package_managers.conda })
138+
)
134139
}
135140

136141
# Configure the Artifactory provider
@@ -171,6 +176,9 @@ resource "coder_script" "jfrog" {
171176
REPOSITORY_PYPI = try(element(var.package_managers.pypi, 0), "")
172177
HAS_DOCKER = length(var.package_managers.docker) == 0 ? "" : "YES"
173178
REGISTER_DOCKER = join("\n", formatlist("register_docker \"%s\"", var.package_managers.docker))
179+
HAS_CONDA = length(var.package_managers.conda) == 0 ? "" : "YES"
180+
CONDA_CONF = local.conda_conf
181+
REPOSITORY_CONDA = try(element(var.package_managers.conda, 0), "")
174182
}
175183
))
176184
run_on_start = true

0 commit comments

Comments
 (0)