All checks were successful
continuous-integration/drone/push Build is passing
147 lines
5.4 KiB
Plaintext
147 lines
5.4 KiB
Plaintext
ALPINE_VERSIONS = ("3.20", "edge")
|
|
JAVA_MAVEN_VERSIONS = ("21",)
|
|
JAVA_GRADLE_VERSIONS = ("8.3-jdk17",)
|
|
PYTHON_VERSIONS = ("3.12",)
|
|
RUST_VERSIONS = ("1.71",)
|
|
SPLUNK_VERSIONS = ("9.1", "9.2")
|
|
UBUNTU_VERSIONS = ("24.04",)
|
|
|
|
TEMPLATES = {
|
|
"_distro": {
|
|
"alpine": {
|
|
"distro_name": "Alpine Linux",
|
|
"distro_shortname": "alpine",
|
|
"distro_icon": "https://s3.mcmaster.io/images/Alpine_Linux_logo.png",
|
|
"distro_package_manager": "apk",
|
|
"distro_releases": ALPINE_VERSIONS,
|
|
"image": "cr.smcm.xyz/coder-images/alpine",
|
|
},
|
|
"aports": {
|
|
"distro_name": "Alpine Linux",
|
|
"distro_shortname": "alpine",
|
|
"distro_icon": "https://s3.mcmaster.io/images/Alpine_Linux_logo.png",
|
|
"distro_package_manager": "apk",
|
|
"distro_releases": ["edge"],
|
|
"image": "cr.smcm.xyz/coder-images/alpine",
|
|
"startup_scripts": ["alpine_aports"],
|
|
},
|
|
"ubuntu": {
|
|
"distro_name": "Ubuntu Linux",
|
|
"distro_shortname": "ubuntu",
|
|
"distro_icon": "/icon/ubuntu.svg",
|
|
"distro_package_manager": "apt",
|
|
"distro_releases": UBUNTU_VERSIONS,
|
|
"image": "cr.smcm.xyz/coder-images/ubuntu",
|
|
},
|
|
},
|
|
"_lang": {
|
|
"gradle": {
|
|
"lang": "gradle",
|
|
"lang_icon": "/icon/java.svg",
|
|
"versions": JAVA_GRADLE_VERSIONS,
|
|
},
|
|
"maven": {
|
|
"lang": "maven",
|
|
"lang_icon": "/icon/java.svg",
|
|
"versions": JAVA_MAVEN_VERSIONS,
|
|
"tag_prefix": "3-eclipse-temurin-",
|
|
},
|
|
"python": {
|
|
"lang": "python",
|
|
"lang_icon": "/icon/python.svg",
|
|
"versions": ["3.8", "3.11"],
|
|
},
|
|
"rust": {
|
|
"lang": "rust",
|
|
"lang_icon": "/icon/rust.svg",
|
|
"versions": RUST_VERSIONS,
|
|
},
|
|
},
|
|
"splunk": {
|
|
"splunk": {
|
|
"image": "cr.smcm.xyz/coder-images/splunk",
|
|
"splunk_versions": ["9.1", "9.2"],
|
|
"coder_user": "splunk",
|
|
"coder_user_home": "/opt/splunk/etc",
|
|
"coder_user_uid": "41812",
|
|
"coder_user_gid": "41812",
|
|
"vs_code_root": "/opt/splunk",
|
|
},
|
|
},
|
|
}
|
|
|
|
def main(ctx):
|
|
pipeline = {
|
|
"kind": "pipeline",
|
|
"name": "default",
|
|
"type": "docker",
|
|
"environment": {},
|
|
"steps": [],
|
|
"trigger": {
|
|
"branch": ["main"],
|
|
"event": ["push", "custom", "cron"],
|
|
},
|
|
}
|
|
|
|
for jinja_template in TEMPLATES:
|
|
for (coder_template, context) in TEMPLATES[jinja_template].items():
|
|
context = {k: v for (k, v) in context.items()}
|
|
|
|
pipeline["steps"].extend([
|
|
{
|
|
"name": "generate {coder_template}".format(coder_template = coder_template),
|
|
"image": "cr.smcm.xyz/drone-plugins/jinja2",
|
|
"settings": {
|
|
"template": "{jinja_template}.tf.j2".format(jinja_template = jinja_template),
|
|
"context": context,
|
|
"output": "{coder_template}/main.tf".format(coder_template = coder_template),
|
|
},
|
|
},
|
|
{
|
|
"name": "upload {coder_template}".format(coder_template = coder_template),
|
|
"image": "plugins/s3",
|
|
"depends_on": [
|
|
"generate {coder_template}".format(coder_template = coder_template),
|
|
],
|
|
"settings": {
|
|
"endpoint": "https://s3.mcmaster.io",
|
|
"bucket": "coder",
|
|
"region": "us-east-1",
|
|
"path_style": "true",
|
|
"access_key": {"from_secret": "minio_access_key_id"},
|
|
"secret_key": {"from_secret": "minio_secret_access_key"},
|
|
"source": "{coder_template}/*".format(coder_template = coder_template),
|
|
"target": "/coder-templates",
|
|
},
|
|
},
|
|
{
|
|
"name": "lint {coder_template}".format(coder_template = coder_template),
|
|
"image": "cr.smcm.xyz/drone-plugins/tflint",
|
|
"settings": {
|
|
"module": coder_template,
|
|
},
|
|
"depends_on": [
|
|
"generate {coder_template}".format(coder_template = coder_template),
|
|
],
|
|
},
|
|
{
|
|
"name": "push {coder_template}".format(coder_template = coder_template),
|
|
"image": "cr.smcm.xyz/drone-plugins/coder",
|
|
"environment": {
|
|
},
|
|
"settings": {
|
|
"template": coder_template,
|
|
"coder_url": "http://coder.coder.svc.cluster.local",
|
|
"coder_session_token": {
|
|
"from_secret": "CODER_SESSION_TOKEN",
|
|
},
|
|
"coder_template_version": ctx.build.commit,
|
|
},
|
|
"depends_on": [
|
|
"lint {coder_template}".format(coder_template = coder_template),
|
|
],
|
|
},
|
|
])
|
|
|
|
return pipeline
|