diff --git a/.drone.star b/.drone.star index cc1b9cd..445316d 100644 --- a/.drone.star +++ b/.drone.star @@ -1,11 +1,13 @@ -CODER_URL = "https://github.com/coder/coder/releases/download/v0.24.1/coder_0.24.1_linux_amd64.tar.gz" +CODER_URL = "https://github.com/coder/coder/releases/download/v2.0.0/coder_2.0.0_linux_amd64.tar.gz" TEMPLATES = { "base": { # "android": {"image": "codercom/enterprise-android:ubuntu"}, # "kubernetes": {"image": "codercom/enterprise-base:ubuntu"}, - "python-38": {"image": "cr.smcm.xyz/coder-images/python-38:latest"}, - "python-311": {"image": "cr.smcm.xyz/coder-images/python-311:latest"}, + "python-38": {"image": "cr.smcm.xyz/coder-images/python-3.8:latest"}, + "python-38-alpine3.18": {"image": "cr.smcm.xyz/coder-images/python-3.8-alpine3.18:latest"}, + "python-311": {"image": "cr.smcm.xyz/coder-images/python-3.11:latest"}, + "python-311-alpine3.18": {"image": "cr.smcm.xyz/coder-images/python-3.11-alpine3.18:latest"}, }, "alpine": { "alpine": {"image": "cr.smcm.xyz/coder-images/alpine:latest"}, @@ -25,6 +27,13 @@ TEMPLATES = { "coder_user_gid": "3434", } }, + "python": { + "python": { + "image": "cr.smcm.xyz/coder-images/python${data.coder_parameter.python_version.value}${locals.alpine}:latest", + "python_versions": "3.8,3.11", + "alpine_version": "3.18" + } + } "splunk": { "splunk": {"image": "cr.smcm.xyz/coder-images/splunk:latest"}, "splunk-82": {"image": "cr.smcm.xyz/coder-images/splunk-8.2:latest"}, diff --git a/base.tf.jinja b/base.tf.jinja index feab9e6..2d45763 100644 --- a/base.tf.jinja +++ b/base.tf.jinja @@ -13,6 +13,11 @@ terraform { } {% endblock %} +locals { +{% block locals %} +{% endblock %} +} + {% block parameters %} {% block cpu_parameter %} data "coder_parameter" "cpu" { @@ -274,7 +279,9 @@ resource "kubernetes_deployment" "main" { {% block kubernetes_pod_main_container %} container { name = "dev" + {% block kubernetes_pod_main_image %} image = "{{image}}" + {% endblock %} {% block kubernetes_pod_main_command %} command = ["bash", "-c", coder_agent.main.init_script] {% endblock %} diff --git a/python.jinja b/python.jinja new file mode 100644 index 0000000..d74c9e4 --- /dev/null +++ b/python.jinja @@ -0,0 +1,28 @@ +{% extends "base.tf.jinja" %} + +{% block locals %} + alpine = $data.coder_parameter.use_alpine.value ? "-alpine{{ alpine_version | replace(".", ",") }}" : "" +{% endblock %} + +{% block parameters %} +{{ super() }} + +data "coder_parameter" "python_version" { + name = "Python Version" + description = "Python Version" + type = "string" + default = "" + + mutable = true + option { + name = "Latest" + value = "" + } + {% for version in python_versions.split(",") %} + option { + name = "{{ version }}" + value = "-{{ version | replace(".", "") }}" + } + {% endfor %} +} +{% endblock %} \ No newline at end of file