This commit is contained in:
parent
bce1dbb6f6
commit
72ec708b5f
@ -18,10 +18,10 @@ TEMPLATES = {
|
||||
"gcloud-terraform": {
|
||||
"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",
|
||||
"startup_scripts": ["gcloud", "terraform"],
|
||||
"distro_package_manager": "apt",
|
||||
"distro_releases": [],
|
||||
"image": "cr.smcm.xyz/coder-images/coder-devops",
|
||||
# "startup_scripts": ["gcloud", "terraform"],
|
||||
},
|
||||
"ubuntu": {
|
||||
"distro_name": "Ubuntu Linux",
|
||||
|
||||
86
alpine.tf.j2
86
alpine.tf.j2
@ -1,86 +0,0 @@
|
||||
{% extends "base.tf.j2" %}
|
||||
|
||||
{% if feature_flags is not defined %}
|
||||
{% set feature_flags = {} %}
|
||||
{% endif %}
|
||||
|
||||
{% block parameters %}
|
||||
{{ super() }}
|
||||
|
||||
{% if alpine_releases|length > 1 %}
|
||||
data "coder_parameter" "alpine_release" {
|
||||
name = "Alpine Release"
|
||||
description = "Alpine Release"
|
||||
type = "string"
|
||||
default = ""
|
||||
|
||||
mutable = true
|
||||
option {
|
||||
name = "Latest"
|
||||
value = ""
|
||||
}
|
||||
{% for version in alpine_releases %}
|
||||
option {
|
||||
name = "{{ version }}"
|
||||
value = "-{{ version }}"
|
||||
}
|
||||
{% endfor %}
|
||||
}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block kubernetes_pod_main_image %}
|
||||
{% if alpine_releases|length > 1 %}
|
||||
image = "{{image}}${data.coder_parameter.alpine_release.value}:latest"
|
||||
{% else %}
|
||||
image = "{{image}}-{{alpine_releases[0]}}:latest"
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block post_startup_script_setup_home %}
|
||||
{% if feature_flags.get("aports") %}
|
||||
# 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
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block startup_script_install_packages %}
|
||||
sudo apk update
|
||||
|
||||
{% if packages_to_install is defined %}
|
||||
sudo apk add {{ packages_to_install | join(" ") }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
13
argocd.tf.j2
13
argocd.tf.j2
@ -1,13 +0,0 @@
|
||||
{% extends "base.tf.j2" %}
|
||||
|
||||
{% block post_startup_script_setup_home %}
|
||||
[ -d "argocd" ] || mkdir argocd
|
||||
|
||||
for REPO in kub odjur kortslutning strukturera ; do
|
||||
[ -d "argocd/$REPO" ] || git clone git@git-ssh.smcm.xyz:argocd/$REPO.git
|
||||
( cd argocd/$REPO && git pull )
|
||||
done
|
||||
|
||||
git config --global user.name "Steve McMaster"
|
||||
git config --global user.email "steve@mcmaster.io"
|
||||
{% endblock %}
|
||||
36
ubuntu.tf.j2
36
ubuntu.tf.j2
@ -1,36 +0,0 @@
|
||||
{% extends "base.tf.j2" %}
|
||||
|
||||
{% block parameters %}
|
||||
{{ super() }}
|
||||
|
||||
data "coder_parameter" "ubuntu_release" {
|
||||
name = "Ubuntu Release"
|
||||
description = "Ubuntu Release"
|
||||
type = "string"
|
||||
default = ""
|
||||
|
||||
mutable = true
|
||||
option {
|
||||
name = "Latest"
|
||||
value = ""
|
||||
}
|
||||
{% for version in ubuntu_releases %}
|
||||
option {
|
||||
name = "{{ version }}"
|
||||
value = "-{{ version }}"
|
||||
}
|
||||
{% endfor %}
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
{% block kubernetes_pod_main_image %}
|
||||
image = "{{image}}${data.coder_parameter.ubuntu_release.value}:latest"
|
||||
{% endblock %}
|
||||
|
||||
{% block startup_script_install_packages %}
|
||||
sudo apt update
|
||||
|
||||
{% if packages_to_install is defined %}
|
||||
sudo apt install {{ packages_to_install | join(" ") }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user