This commit is contained in:
parent
17b0e1b895
commit
15f47ca582
68
.drone.star
68
.drone.star
@ -1,27 +1,58 @@
|
|||||||
TEMPLATES = {
|
TEMPLATES = {
|
||||||
|
"_distro": {
|
||||||
|
"alpine": {
|
||||||
|
"distro_name": "Alpine Linux",
|
||||||
|
"distro_shortname": "alpine",
|
||||||
|
"distro_package_manager": "apk",
|
||||||
|
"distro_releases": ["3.17", "3.18", "edge"],
|
||||||
|
"image": "cr.smcm.xyz/coder-images/alpine",
|
||||||
|
},
|
||||||
|
"aports": {
|
||||||
|
"distro_name": "Alpine Linux",
|
||||||
|
"distro_shortname": "alpine",
|
||||||
|
"distro_package_manager": "apk",
|
||||||
|
"distro_releases": ["edge"],
|
||||||
|
"image": "cr.smcm.xyz/coder-images/alpine",
|
||||||
|
},
|
||||||
|
"ubuntu": {
|
||||||
|
"distro_name": "Ubuntu Linux",
|
||||||
|
"distro_shortname": "ubuntu",
|
||||||
|
"distro_package_manager": "apk",
|
||||||
|
"distro_releases": ["20.04", "22.04", "23.04", "23.10"],
|
||||||
|
"image": "cr.smcm.xyz/coder-images/ubuntu",
|
||||||
|
},
|
||||||
|
},
|
||||||
"_lang": {
|
"_lang": {
|
||||||
"eclipse-temurin": {
|
"eclipse-temurin": {
|
||||||
"lang": "eclipse-temurin",
|
"lang": "eclipse-temurin",
|
||||||
"versions": ["11-jdk", "17-jdk", "21-jdk"],
|
"versions": ["11-jdk", "17-jdk", "21-jdk"],
|
||||||
"container_base_choices": [
|
"distro_choices": [
|
||||||
{"label": "Ubuntu Jammy", "suffix": ""},
|
{"label": "Ubuntu", "suffix": ""},
|
||||||
{"label": "Alpine Linux", "suffix": "-alpine"},
|
{"label": "Alpine Linux", "suffix": "-alpine"},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"golang": {
|
"golang": {
|
||||||
"lang": "golang",
|
"lang": "golang",
|
||||||
"versions": ["1.21"],
|
"versions": ["1.21"],
|
||||||
|
"distro_choices": [
|
||||||
|
{"label": "Debian", "suffix": ""},
|
||||||
|
{"label": "Alpine Linux", "suffix": "-alpine"},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"gradle": {
|
"gradle": {
|
||||||
"lang": "gradle",
|
"lang": "gradle",
|
||||||
"versions": ["8.3-jdk17"],
|
"versions": ["8.3-jdk17"],
|
||||||
"coder_user": "gradle",
|
"coder_user": "gradle",
|
||||||
|
"distro_choices": [
|
||||||
|
{"label": "Debian", "suffix": ""},
|
||||||
|
{"label": "Alpine Linux", "suffix": "-alpine"},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"maven": {
|
"maven": {
|
||||||
"lang": "eclipse-temurin-maven",
|
"lang": "eclipse-temurin-maven",
|
||||||
"versions": ["11", "17", "21"],
|
"versions": ["11", "17", "21"],
|
||||||
"container_base_choices": [
|
"distro_choices": [
|
||||||
{"label": "Ubuntu Focal", "suffix": ""},
|
{"label": "Ubuntu", "suffix": ""},
|
||||||
{"label": "Alpine Linux", "suffix": "-alpine"},
|
{"label": "Alpine Linux", "suffix": "-alpine"},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -29,25 +60,26 @@ TEMPLATES = {
|
|||||||
"lang": "node",
|
"lang": "node",
|
||||||
"versions": ["18", "20"],
|
"versions": ["18", "20"],
|
||||||
"coder_user": "node",
|
"coder_user": "node",
|
||||||
|
"distro_choices": [
|
||||||
|
{"label": "Debian", "suffix": ""},
|
||||||
|
{"label": "Alpine Linux", "suffix": "-alpine"},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"python": {
|
"python": {
|
||||||
"lang": "python",
|
"lang": "python",
|
||||||
"versions": ["3.8", "3.11"],
|
"versions": ["3.8", "3.11"],
|
||||||
|
"distro_choices": [
|
||||||
|
{"label": "Debian", "suffix": ""},
|
||||||
|
{"label": "Alpine Linux", "suffix": "-alpine"},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"rust": {
|
"rust": {
|
||||||
"lang": "rust",
|
"lang": "rust",
|
||||||
"versions": ["1.71"],
|
"versions": ["1.71"],
|
||||||
},
|
"distro_choices": [
|
||||||
},
|
{"label": "Debian", "suffix": ""},
|
||||||
"alpine": {
|
{"label": "Alpine Linux", "suffix": "-alpine"},
|
||||||
"alpine": {
|
]
|
||||||
"image": "cr.smcm.xyz/coder-images/alpine",
|
|
||||||
"alpine_releases": ["3.17", "3.18", "edge"],
|
|
||||||
},
|
|
||||||
"aports": {
|
|
||||||
"image": "cr.smcm.xyz/coder-images/alpine",
|
|
||||||
"alpine_releases": ["edge"],
|
|
||||||
"feature_flags": {"aports": True}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
@ -83,12 +115,6 @@ TEMPLATES = {
|
|||||||
"terraform_versions": ["1.6"],
|
"terraform_versions": ["1.6"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"ubuntu": {
|
|
||||||
"ubuntu": {
|
|
||||||
"image": "cr.smcm.xyz/coder-images/ubuntu",
|
|
||||||
"ubuntu_releases": ["20.04", "22.04", "23.04", "23.10"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def main(ctx):
|
def main(ctx):
|
||||||
|
|||||||
53
_distro.jinja
Normal file
53
_distro.jinja
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{% extends "base.tf.jinja" %}
|
||||||
|
|
||||||
|
{% block parameters %}
|
||||||
|
{{ super() }}
|
||||||
|
|
||||||
|
data "coder_parameter" "distro_release" {
|
||||||
|
name = "{{ distro_name }} Release"
|
||||||
|
description = "{{ distro_name }} Release"
|
||||||
|
type = "string"
|
||||||
|
default = ""
|
||||||
|
|
||||||
|
mutable = true
|
||||||
|
option {
|
||||||
|
name = "Latest"
|
||||||
|
value = ""
|
||||||
|
}
|
||||||
|
{% for version in distro_releases %}
|
||||||
|
option {
|
||||||
|
name = "{{ version["name"] }}"
|
||||||
|
value = {% if "suffix" in version %}"-{{ version["suffix"] }}"{% else %}""{% endif %}
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block kubernetes_pod_main_image %}
|
||||||
|
image = "{{image}}${data.coder_parameter.distro_release.value}:latest"
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block post_startup_script_setup_home %}
|
||||||
|
{% if feature_flags is defined %}
|
||||||
|
{% for feature_flag in feature_flags %}
|
||||||
|
{% set template = distro_shortname + "/" + feature_flag + ".tf.jinja" %}
|
||||||
|
{% inlcude template %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block startup_script_install_packages %}
|
||||||
|
{% if distro_package_manager == "apt" %}
|
||||||
|
sudo apt update
|
||||||
|
|
||||||
|
{% if packages_to_install is defined %}
|
||||||
|
sudo apt install {{ packages_to_install | join(" ") }}
|
||||||
|
{% endif %}
|
||||||
|
{% elif distro_package_manager == "apk" %}
|
||||||
|
sudo apk update
|
||||||
|
|
||||||
|
{% if packages_to_install is defined %}
|
||||||
|
sudo apk add {{ packages_to_install | join(" ") }}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@ -1,9 +1,5 @@
|
|||||||
{% 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() }}
|
||||||
|
|
||||||
@ -30,12 +26,12 @@ data "coder_parameter" "container_base" {
|
|||||||
name = "Container Base"
|
name = "Container Base"
|
||||||
description = "Container Base"
|
description = "Container Base"
|
||||||
type = "string"
|
type = "string"
|
||||||
default = "{{ container_base_choices[0]["suffix"] }}"
|
default = "{{ distro_choices[0]["suffix"] }}"
|
||||||
mutable = false
|
mutable = false
|
||||||
{% for container_base_choice in container_base_choices %}
|
{% for distro_choice in distro_choices %}
|
||||||
option {
|
option {
|
||||||
name = "{{ container_base_choice["label"] }}"
|
name = "{{ distro_choice["label"] }}"
|
||||||
value = "{{ container_base_choice["suffix"] }}"
|
value = "{{ distro_choice["suffix"] }}"
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
}
|
}
|
||||||
|
|||||||
35
alpine/aports.tf.jinja
Normal file
35
alpine/aports.tf.jinja
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Ensure host key verification passes
|
||||||
|
if [ ! -f .ssh/known_hosts ]; then
|
||||||
|
mkdir -p .ssh
|
||||||
|
ssh-keyscan gitlab.alpinelinux.org > .ssh/known_hosts
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clone the aports repository
|
||||||
|
if [ ! -d aports/.git ]; then
|
||||||
|
git clone git@gitlab.alpinelinux.org:alpine/aports.git
|
||||||
|
git config remote.origin.pushurl git@gitlab.alpinelinux.org:mcm/aports.git
|
||||||
|
else
|
||||||
|
(
|
||||||
|
cd aports
|
||||||
|
git remote set-url origin git@gitlab.alpinelinux.org:alpine/aports.git
|
||||||
|
git config remote.origin.pushurl git@gitlab.alpinelinux.org:mcm/aports.git
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate abuild keys if needed
|
||||||
|
if [ ! -f "$HOME/.abuild/abuild.conf" ]; then
|
||||||
|
abuild-keygen -a -i -n
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -e "$HOME/.abuild/abuild.conf" ] && . $HOME/.abuild/abuild.conf
|
||||||
|
|
||||||
|
if [ -n "$PACKAGER_PRIVKEY" ]; then
|
||||||
|
sudo cp $PACKAGER_PRIVKEY /etc/apk/keys/
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update apk
|
||||||
|
for repo in main community testing ; do
|
||||||
|
REPO="$HOME/packages/$repo"
|
||||||
|
grep -q "^$REPO" /etc/apk/repositories || (echo $REPO | sudo tee -a /etc/apk/repositories)
|
||||||
|
done
|
||||||
|
sudo apk update
|
||||||
Reference in New Issue
Block a user