This commit is contained in:
parent
daaef1bbbd
commit
492dd16831
38
.drone.star
38
.drone.star
@ -1,12 +1,26 @@
|
||||
TEMPLATES = {
|
||||
"_lang": {
|
||||
"eclipise-temurin": {
|
||||
"lang": "eclipise-temurin",
|
||||
"versions": ["1.21"],
|
||||
"container_base_choices": [
|
||||
{"label": "Ubuntu Jammy", "suffix": "-jammy"},
|
||||
{"label": "Alpine Linux", "suffix": "-alpine"},
|
||||
]
|
||||
},
|
||||
"golang": {
|
||||
"lang": "golang",
|
||||
"versions": ["1.21"],
|
||||
},
|
||||
"gradle": {
|
||||
"lang": "gradle",
|
||||
"versions": ["8.3-jdk17"],
|
||||
"coder_user": "gradle",
|
||||
}
|
||||
"node": {
|
||||
"lang": "node",
|
||||
"versions": ["18", "20"],
|
||||
"coder_user": "node",
|
||||
},
|
||||
"python": {
|
||||
"lang": "python",
|
||||
@ -26,28 +40,28 @@ TEMPLATES = {
|
||||
"android": {
|
||||
"android-2023-06": {
|
||||
"image": "cr.smcm.xyz/coder-images/android-2023.06",
|
||||
"coder_user": "circleci",
|
||||
"coder_user_uid": "1001",
|
||||
"coder_user_gid": "1002",
|
||||
},
|
||||
},
|
||||
"argocd": {
|
||||
"argocd": {
|
||||
"image": "cr.smcm.xyz/coder-images/alpine-3.18",
|
||||
},
|
||||
},
|
||||
"gradle": {
|
||||
"gradle": {
|
||||
"lang": "gradle",
|
||||
"versions": ["8.3-jdk17"],
|
||||
"vs_code_root": "/home/circleci/project",
|
||||
},
|
||||
},
|
||||
"jupyter": {
|
||||
"jupyter-scipy-notebook": {"image": "cr.smcm.xyz/coder-images/jupyter-scipy-notebook"},
|
||||
"jupyter-scipy-notebook": {
|
||||
"image": "cr.smcm.xyz/coder-images/jupyter-scipy-notebook",
|
||||
"coder_user": "jovyan",
|
||||
"coder_user_gid": "100"
|
||||
},
|
||||
},
|
||||
"splunk": {
|
||||
"splunk": {
|
||||
"image": "cr.smcm.xyz/coder-images/splunk",
|
||||
"splunk_versions": ["8.2", "9.0", "9.1"],
|
||||
"coder_user": "splunk",
|
||||
"coder_user_home": "/opt/splunk/etc",
|
||||
"coder_user_uid": "41812",
|
||||
"coder_user_gid": "41812",
|
||||
"vs_code_root": "/opt/splunk"
|
||||
},
|
||||
},
|
||||
"ubuntu": {
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
{% extends "base.tf.jinja" %}
|
||||
|
||||
{% if container_base_choices is not defined %}
|
||||
{% set container_base_choices = [{"label": "Debian Linux", "suffix": ""}, {"label": "Alpine Linux", "suffix": "-alpine"}] %}
|
||||
{% endif %}
|
||||
|
||||
{% block parameters %}
|
||||
{{ super() }}
|
||||
|
||||
@ -26,15 +30,12 @@ data "coder_parameter" "container_base" {
|
||||
name = "Container Base"
|
||||
description = "Container Base"
|
||||
type = "string"
|
||||
default = ""
|
||||
default = "{{ container_base_choices[0]["label"] }}"
|
||||
mutable = false
|
||||
{% for container_base_choice in container_base_choices %}
|
||||
option {
|
||||
name = "Debian Linux"
|
||||
value = ""
|
||||
}
|
||||
option {
|
||||
name = "Alpine Linux"
|
||||
value = "-alpine"
|
||||
name = "{{ container_base_choice["label"] }}"
|
||||
value = "{{ container_base_choice["suffix"] }}"
|
||||
}
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
@ -13,6 +13,26 @@ terraform {
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
{% if coder_user is not defined %}
|
||||
{% set coder_user = "coder" %}
|
||||
{% endif %}
|
||||
|
||||
{% if coder_user_uid is not defined %}
|
||||
{% set coder_user_uid = "1000" %}
|
||||
{% endif %}
|
||||
|
||||
{% if coder_user_gid is not defined %}
|
||||
{% set coder_user_gid = "1000" %}
|
||||
{% endif %}
|
||||
|
||||
{% if coder_user_home is not defined %}
|
||||
{% set coder_user_home = "/home/" + coder_user %}
|
||||
{% endif %}
|
||||
|
||||
{% if vs_code_root is not defined %}
|
||||
{% set vs_code_root = coder_user_home %}
|
||||
{% endif %}
|
||||
|
||||
locals {
|
||||
{% block locals %}
|
||||
{% endblock %}
|
||||
@ -179,7 +199,7 @@ resource "coder_app" "code-server" {
|
||||
slug = "code-server"
|
||||
display_name = "VS Code Web"
|
||||
icon = "/icon/code.svg"
|
||||
url = "http://localhost:13337?folder={{ vs_code_root|default("/home/coder", true) }}"
|
||||
url = "http://localhost:13337?folder={{ vs_code_root }}"
|
||||
subdomain = false
|
||||
share = "owner"
|
||||
|
||||
@ -271,8 +291,8 @@ resource "kubernetes_deployment" "main" {
|
||||
spec {
|
||||
{% block kubernetes_pod_main_security_context %}
|
||||
security_context {
|
||||
run_as_user = "{{ coder_user_uid|default("1000", true) }}"
|
||||
fs_group = "{{ coder_user_gid|default("1000", true) }}"
|
||||
run_as_user = "{{ coder_user_uid }}"
|
||||
fs_group = "{{ coder_user_gid }}"
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
@ -288,7 +308,7 @@ resource "kubernetes_deployment" "main" {
|
||||
|
||||
{% block kubernetes_pod_main_container_security_context %}
|
||||
security_context {
|
||||
run_as_user = "{{ coder_user_uid|default("1000", true) }}"
|
||||
run_as_user = "{{ coder_user_uid }}"
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
@ -318,7 +338,7 @@ resource "kubernetes_deployment" "main" {
|
||||
|
||||
{% block kubernetes_pod_main_volume_mount %}
|
||||
volume_mount {
|
||||
mount_path = "/home/coder"
|
||||
mount_path = "{{ coder_user_home }}"
|
||||
name = "home"
|
||||
read_only = false
|
||||
}
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
{% extends "_lang.tf.jinja" %}
|
||||
|
||||
{% set vs_code_root = "/home/gradle" %}
|
||||
|
||||
{% block kubernetes_pod_main_volume_mount %}
|
||||
volume_mount {
|
||||
mount_path = "/home/gradle"
|
||||
name = "home"
|
||||
read_only = false
|
||||
}
|
||||
{% endblock %}
|
||||
@ -1,7 +1,5 @@
|
||||
{% extends "base.tf.jinja" %}
|
||||
|
||||
{% set coder_user_gid = 100 %}
|
||||
|
||||
{% block coder_apps %}
|
||||
resource "coder_app" "jupyter" {
|
||||
agent_id = coder_agent.main.id
|
||||
@ -39,11 +37,3 @@ resource "coder_app" "jupyter" {
|
||||
{% block post_startup_script_setup_home %}
|
||||
/usr/local/bin/start-notebook.sh | tee jupyter-startup.log &
|
||||
{% endblock %}
|
||||
|
||||
{% block kubernetes_pod_main_volume_mount %}
|
||||
volume_mount {
|
||||
mount_path = "/home/jovyan"
|
||||
name = "home"
|
||||
read_only = false
|
||||
}
|
||||
{% endblock %}
|
||||
@ -1,9 +1,5 @@
|
||||
{% extends "base.tf.jinja" %}
|
||||
|
||||
{% set coder_user_uid = 41812 %}
|
||||
{% set coder_user_gid = 41812 %}
|
||||
{% set vs_code_root = "/opt/splunk" %}
|
||||
|
||||
{% block coder_apps %}
|
||||
resource "coder_app" "splunk" {
|
||||
agent_id = coder_agent.main.id
|
||||
|
||||
Reference in New Issue
Block a user