Skip to content

Commit 79e2fdd

Browse files
authored
Merge branch 'main' into aider-tasks-agentapi-support
2 parents fef659e + f1010ee commit 79e2fdd

File tree

15 files changed

+265
-33
lines changed

15 files changed

+265
-33
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Validate formatting
4949
run: bun fmt:ci
5050
- name: Check for typos
51-
uses: crate-ci/typos@v1.35.5
51+
uses: crate-ci/typos@v1.36.2
5252
with:
5353
config: .github/typos.toml
5454
validate-readme-files:
@@ -61,7 +61,7 @@ jobs:
6161
- name: Check out code
6262
uses: actions/checkout@v5
6363
- name: Set up Go
64-
uses: actions/setup-go@v5
64+
uses: actions/setup-go@v6
6565
with:
6666
go-version: "1.23.2"
6767
- name: Validate contributors

.github/workflows/deploy-registry.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ jobs:
3030
- name: Checkout code
3131
uses: actions/checkout@v5
3232
- name: Authenticate with Google Cloud
33-
uses: google-github-actions/auth@b7593ed2efd1c1617e1b0254da33b86225adb2a5
33+
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093
3434
with:
3535
workload_identity_provider: projects/309789351055/locations/global/workloadIdentityPools/github-actions/providers/github
3636
service_account: registry-v2-github@coder-registry-1.iam.gserviceaccount.com
3737
- name: Set up Google Cloud SDK
38-
uses: google-github-actions/setup-gcloud@26f734c2779b00b7dda794207734c511110a4368
38+
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db
3939
- name: Deploy to dev.registry.coder.com
4040
run: gcloud builds triggers run 29818181-126d-4f8a-a937-f228b27d3d34 --branch main
4141
- name: Deploy to registry.coder.com

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v5
18-
- uses: actions/setup-go@v5
18+
- uses: actions/setup-go@v6
1919
with:
2020
go-version: stable
2121
- name: golangci-lint

.github/workflows/version-bump.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
9696
- name: Comment on PR - Failure
9797
if: failure() && steps.version-check.outputs.versions_up_to_date == 'false'
98-
uses: actions/github-script@v7
98+
uses: actions/github-script@v8
9999
with:
100100
github-token: ${{ secrets.GITHUB_TOKEN }}
101101
script: |

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.1.0"
19+
version = "1.2.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"
@@ -27,6 +27,7 @@ module "jfrog" {
2727
pypi = ["pypi", "extra-index-pypi"]
2828
docker = ["example-docker-staging.jfrog.io", "example-docker-production.jfrog.io"]
2929
conda = ["conda", "conda-local"]
30+
maven = ["maven", "maven-local"]
3031
}
3132
}
3233
```
@@ -46,7 +47,7 @@ Configure the Python pip package manager to fetch packages from Artifactory whil
4647
module "jfrog" {
4748
count = data.coder_workspace.me.start_count
4849
source = "registry.coder.com/coder/jfrog-oauth/coder"
49-
version = "1.1.0"
50+
version = "1.2.0"
5051
agent_id = coder_agent.example.id
5152
jfrog_url = "https://example.jfrog.io"
5253
username_field = "email"
@@ -75,7 +76,7 @@ The [JFrog extension](https://open-vsx.org/extension/JFrog/jfrog-vscode-extensio
7576
module "jfrog" {
7677
count = data.coder_workspace.me.start_count
7778
source = "registry.coder.com/coder/jfrog-oauth/coder"
78-
version = "1.1.0"
79+
version = "1.2.0"
7980
agent_id = coder_agent.example.id
8081
jfrog_url = "https://example.jfrog.io"
8182
username_field = "username" # If you are using GitHub to login to both Coder and Artifactory, use username_field = "username"

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,38 @@ EOF`;
150150
'if [ -z "YES" ]; then\n not_configured conda',
151151
);
152152
});
153+
it("generates a maven settings.xml with multiple repos", async () => {
154+
const state = await runTerraformApply<TestVariables>(import.meta.dir, {
155+
agent_id: "some-agent-id",
156+
jfrog_url: fakeFrogUrl,
157+
package_managers: JSON.stringify({
158+
maven: ["central", "snapshots", "local"],
159+
}),
160+
});
161+
162+
const coderScript = findResourceInstance(state, "coder_script");
163+
164+
expect(coderScript.script).toContain(
165+
'jf mvnc --global --repo-resolve "central"',
166+
);
167+
168+
expect(coderScript.script).toContain("<servers>");
169+
expect(coderScript.script).toContain("<id>central</id>");
170+
expect(coderScript.script).toContain("<id>snapshots</id>");
171+
expect(coderScript.script).toContain("<id>local</id>");
172+
173+
expect(coderScript.script).toContain(
174+
"<url>http://localhost:8081/artifactory/central</url>",
175+
);
176+
expect(coderScript.script).toContain(
177+
"<url>http://localhost:8081/artifactory/snapshots</url>",
178+
);
179+
expect(coderScript.script).toContain(
180+
"<url>http://localhost:8081/artifactory/local</url>",
181+
);
182+
183+
expect(coderScript.script).toContain(
184+
'if [ -z "YES" ]; then\n not_configured maven',
185+
);
186+
});
153187
});

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ variable "package_managers" {
5959
pypi = optional(list(string), [])
6060
docker = optional(list(string), [])
6161
conda = optional(list(string), [])
62+
maven = optional(list(string), [])
6263
})
6364
description = <<-EOF
6465
A map of package manager names to their respective artifactory repositories. Unused package managers can be omitted.
@@ -69,6 +70,7 @@ variable "package_managers" {
6970
pypi = ["YOUR_PYPI_REPO_KEY", "ANOTHER_PYPI_REPO_KEY"]
7071
docker = ["YOUR_DOCKER_REPO_KEY", "ANOTHER_DOCKER_REPO_KEY"]
7172
conda = ["YOUR_CONDA_REPO_KEY", "ANOTHER_CONDA_REPO_KEY"]
73+
maven = ["YOUR_MAVEN_REPO_KEY", "ANOTHER_MAVEN_REPO_KEY"]
7274
}
7375
EOF
7476
}
@@ -103,6 +105,9 @@ locals {
103105
conda_conf = templatefile(
104106
"${path.module}/conda.conf.tftpl", merge(local.common_values, { REPOS = var.package_managers.conda })
105107
)
108+
maven_settings = templatefile(
109+
"${path.module}/settings.xml.tftpl", merge(local.common_values, { REPOS = var.package_managers.maven })
110+
)
106111
}
107112

108113
data "coder_workspace" "me" {}
@@ -133,6 +138,9 @@ resource "coder_script" "jfrog" {
133138
HAS_CONDA = length(var.package_managers.conda) == 0 ? "" : "YES"
134139
CONDA_CONF = local.conda_conf
135140
REPOSITORY_CONDA = try(element(var.package_managers.conda, 0), "")
141+
HAS_MAVEN = length(var.package_managers.maven) == 0 ? "" : "YES"
142+
MAVEN_SETTINGS = local.maven_settings
143+
REPOSITORY_MAVEN = try(element(var.package_managers.maven, 0), "")
136144
}
137145
))
138146
run_on_start = true

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,20 @@ EOF
9494
config_complete
9595
fi
9696

97+
# Configure Maven to use the Artifactory "maven" repository.
98+
if [ -z "${HAS_MAVEN}" ]; then
99+
not_configured maven
100+
else
101+
echo "☕ Configuring maven..."
102+
jf mvnc --global --repo-resolve "${REPOSITORY_MAVEN}"
103+
# Create Maven config directory if it doesn't exist
104+
mkdir -p ~/.m2
105+
cat << EOF > ~/.m2/settings.xml
106+
${MAVEN_SETTINGS}
107+
EOF
108+
config_complete
109+
fi
110+
97111
# Install the JFrog vscode extension for code-server.
98112
if [ "${CONFIGURE_CODE_SERVER}" == "true" ]; then
99113
while ! [ -x /tmp/code-server/bin/code-server ]; do
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
5+
http://maven.apache.org/xsd/settings-1.0.0.xsd">
6+
7+
<servers>
8+
%{ for REPO in REPOS ~}
9+
<server>
10+
<id>${REPO}</id>
11+
<username>${ARTIFACTORY_USERNAME}</username>
12+
<password>${ARTIFACTORY_ACCESS_TOKEN}</password>
13+
</server>
14+
%{ endfor ~}
15+
</servers>
16+
17+
<profiles>
18+
<profile>
19+
<id>artifactory</id>
20+
<repositories>
21+
%{ for REPO in REPOS ~}
22+
<repository>
23+
<id>${REPO}</id>
24+
<url>${JFROG_URL}/artifactory/${REPO}</url>
25+
<releases>
26+
<enabled>true</enabled>
27+
</releases>
28+
<snapshots>
29+
<enabled>true</enabled>
30+
</snapshots>
31+
</repository>
32+
%{ endfor ~}
33+
</repositories>
34+
<pluginRepositories>
35+
%{ for REPO in REPOS ~}
36+
<pluginRepository>
37+
<id>${REPO}</id>
38+
<url>${JFROG_URL}/artifactory/${REPO}</url>
39+
<releases>
40+
<enabled>true</enabled>
41+
</releases>
42+
<snapshots>
43+
<enabled>true</enabled>
44+
</snapshots>
45+
</pluginRepository>
46+
%{ endfor ~}
47+
</pluginRepositories>
48+
</profile>
49+
</profiles>
50+
51+
<activeProfiles>
52+
<activeProfile>artifactory</activeProfile>
53+
</activeProfiles>
54+
55+
</settings>

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

Lines changed: 9 additions & 5 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.1.0"
16+
version = "1.2.0"
1717
agent_id = coder_agent.example.id
1818
jfrog_url = "https://XXXX.jfrog.io"
1919
artifactory_access_token = var.artifactory_access_token
@@ -23,6 +23,7 @@ module "jfrog" {
2323
pypi = ["pypi", "extra-index-pypi"]
2424
docker = ["example-docker-staging.jfrog.io", "example-docker-production.jfrog.io"]
2525
conda = ["conda", "conda-local"]
26+
maven = ["maven", "maven-local"]
2627
}
2728
}
2829
```
@@ -41,7 +42,7 @@ For detailed instructions, please see this [guide](https://coder.com/docs/v2/lat
4142
```tf
4243
module "jfrog" {
4344
source = "registry.coder.com/coder/jfrog-token/coder"
44-
version = "1.1.0"
45+
version = "1.2.0"
4546
agent_id = coder_agent.example.id
4647
jfrog_url = "https://YYYY.jfrog.io"
4748
artifactory_access_token = var.artifactory_access_token # An admin access token
@@ -50,24 +51,27 @@ module "jfrog" {
5051
go = ["go-local"]
5152
pypi = ["pypi-local"]
5253
conda = ["conda-local"]
54+
maven = ["maven-local"]
5355
}
5456
}
5557
```
5658

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.
59+
You should now be able to install packages from Artifactory using both the `jf npm`, `jf go`, `jf pip` and `npm`, `go`, `pip`, `conda`, `maven` commands.
5860

5961
```shell
6062
jf npm install prettier
6163
jf go get github.com/golang/example/hello
6264
jf pip install requests
6365
conda install numpy
66+
mvn clean install
6467
```
6568

6669
```shell
6770
npm install prettier
6871
go get github.com/golang/example/hello
6972
pip install requests
7073
conda install numpy
74+
mvn clean install
7175
```
7276

7377
### Configure code-server with JFrog extension
@@ -77,7 +81,7 @@ The [JFrog extension](https://open-vsx.org/extension/JFrog/jfrog-vscode-extensio
7781
```tf
7882
module "jfrog" {
7983
source = "registry.coder.com/coder/jfrog-token/coder"
80-
version = "1.1.0"
84+
version = "1.2.0"
8185
agent_id = coder_agent.example.id
8286
jfrog_url = "https://XXXX.jfrog.io"
8387
artifactory_access_token = var.artifactory_access_token
@@ -97,7 +101,7 @@ data "coder_workspace" "me" {}
97101
98102
module "jfrog" {
99103
source = "registry.coder.com/coder/jfrog-token/coder"
100-
version = "1.1.0"
104+
version = "1.2.0"
101105
agent_id = coder_agent.example.id
102106
jfrog_url = "https://XXXX.jfrog.io"
103107
artifactory_access_token = var.artifactory_access_token

0 commit comments

Comments
 (0)