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