Skip to content

Commit 31f7b39

Browse files
authored
chore(dogfood): update dogfood template to use artifactory (#11452)
* chore(dogfood): update to use artifactory * Update main.tf
1 parent da7859c commit 31f7b39

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

dogfood/main.tf

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ terraform {
1010
}
1111
}
1212

13+
variable "jfrog_url" {
14+
type = string
15+
description = "Artifactory URL. e.g. https://myartifactory.example.com"
16+
# ensue the URL is HTTPS or HTTP
17+
validation {
18+
condition = can(regex("^(https|http)://", var.jfrog_url))
19+
error_message = "jfrog_url must be a valid URL starting with either 'https://' or 'http://'"
20+
}
21+
}
22+
1323
locals {
1424
// These are cluster service addresses mapped to Tailscale nodes. Ask Dean or
1525
// Kyle for help.
@@ -21,7 +31,10 @@ locals {
2131
"sa-saopaulo" = "tcp://oberstein-sao-cdr-dev.tailscale.svc.cluster.local:2375"
2232
}
2333

24-
repo_dir = replace(data.coder_parameter.repo_dir.value, "/^~\\//", "/home/coder/")
34+
repo_dir = replace(data.coder_parameter.repo_dir.value, "/^~\\//", "/home/coder/")
35+
container_name = "coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}"
36+
registry_name = "codercom/oss-dogfood"
37+
jfrog_host = replace(var.jfrog_url, "https://", "")
2538
}
2639

2740
data "coder_parameter" "repo_dir" {
@@ -125,6 +138,20 @@ module "coder-login" {
125138
agent_id = coder_agent.dev.id
126139
}
127140

141+
module "jfrog" {
142+
source = "https://registry.coder.com/modules/jfrog-oauth"
143+
agent_id = coder_agent.dev.id
144+
jfrog_url = var.jfrog_url
145+
configure_code_server = true
146+
username_field = "username"
147+
package_managers = {
148+
"npm" : "npm",
149+
"go" : "go",
150+
"pypi" : "pypi",
151+
"docker" : "docker"
152+
}
153+
}
154+
128155
resource "coder_agent" "dev" {
129156
arch = "amd64"
130157
os = "linux"
@@ -219,8 +246,9 @@ resource "coder_agent" "dev" {
219246
startup_script_timeout = 60
220247
startup_script = <<-EOT
221248
set -eux -o pipefail
249+
# Start Docker service
222250
sudo service docker start
223-
EOT
251+
EOT
224252
}
225253

226254
resource "docker_volume" "home_volume" {
@@ -250,10 +278,6 @@ resource "docker_volume" "home_volume" {
250278
}
251279
}
252280

253-
locals {
254-
container_name = "coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}"
255-
registry_name = "codercom/oss-dogfood"
256-
}
257281
data "docker_registry_image" "dogfood" {
258282
name = "${local.registry_name}:latest"
259283
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy