Compare commits

...

2 Commits

Author SHA1 Message Date
ee4720e7fa fix 2023-02-24 23:27:45 -05:00
9344b539e3 fix 2023-02-24 23:26:46 -05:00
2 changed files with 33 additions and 32 deletions

View File

@ -18,11 +18,11 @@ TEMPLATES = {
"splunk-82": {"image": "cr.smcm.xyz/coder-images/splunk-8.2:latest"}, "splunk-82": {"image": "cr.smcm.xyz/coder-images/splunk-8.2:latest"},
"splunk-90": {"image": "cr.smcm.xyz/coder-images/splunk-9.0:latest"}, "splunk-90": {"image": "cr.smcm.xyz/coder-images/splunk-9.0:latest"},
}, },
"proxychains": { # "proxychains": {
"splunk-python": {"image": "cr.smcm.xyz/coder-images/python-38:latest"}, # "splunk-python": {"image": "cr.smcm.xyz/coder-images/python-38:latest"},
}, # },
"jupyter": { "jupyter": {
"jupyter": {"image": "cr.smcm.xyz/coder-images/jupyter-scipy-notebook:latest"}, "jupyter-scipy-notebook": {"image": "cr.smcm.xyz/coder-images/jupyter-scipy-notebook:latest"},
}, },
} }
@ -36,11 +36,14 @@ def get_jinja_command(template, output, context):
) )
def main(ctx): def main(ctx):
pipeline = {
"kind": "pipeline",
"name": "default",
"type": "docker",
"steps": [],
}
jinja_commands = [] jinja_commands = []
coder_commands = [
"apk add git",
"wget -q -O- {url} | tar -xzf - -C /usr/local/bin ./coder".format(url = CODER_URL),
]
for jinja_template in TEMPLATES: for jinja_template in TEMPLATES:
for coder_template in TEMPLATES[jinja_template]: for coder_template in TEMPLATES[jinja_template]:
@ -51,25 +54,8 @@ def main(ctx):
TEMPLATES[jinja_template][coder_template], TEMPLATES[jinja_template][coder_template],
)) ))
coder_commands.append( pipeline["steps"].append({
" || ".join([ "name": "push {name}".format(name = coder_template),
"coder templates push -d {name} --yes {name}".format(name = coder_template),
"coder templates create -d {name} --yes {name}".format(name = coder_template),
]),
)
return {
"kind": "pipeline",
"name": "default",
"type": "docker",
"steps": [
{
"name": "generate templates",
"image": "roquie/docker-jinja2-cli",
"commands": jinja_commands,
},
{
"name": "push templates",
"image": "alpine:latest", "image": "alpine:latest",
"environment": { "environment": {
"CODER_URL": "http://coder.coder.svc.cluster.local", "CODER_URL": "http://coder.coder.svc.cluster.local",
@ -78,7 +64,21 @@ def main(ctx):
}, },
"CODER_TEMPLATE_VERSION": ctx.build.commit, "CODER_TEMPLATE_VERSION": ctx.build.commit,
}, },
"commands": coder_commands, "commands": [
}, "apk add git",
"wget -q -O- {url} | tar -xzf - -C /usr/local/bin ./coder".format(url = CODER_URL),
" || ".join([
"coder templates push -d {name} --yes {name}".format(name = coder_template),
"coder templates create -d {name} --yes {name}".format(name = coder_template),
]),
], ],
} "depends_on": [
"generate templates",
],
})
pipeline["steps"].insert(0, {
"name": "generate templates",
"image": "roquie/docker-jinja2-cli",
"commands": jinja_commands,
})

View File

@ -10,7 +10,7 @@ resource "coder_app" "jupyter" {
share = "public" share = "public"
healthcheck { healthcheck {
url = "http://localhost:8888/lab" url = "http://localhost:8888/api"
interval = 3 interval = 3
threshold = 10 threshold = 10
} }
@ -30,4 +30,5 @@ resource "coder_app" "jupyter" {
{% endblock %} {% endblock %}
{% block post_startup_script_setup_home %} {% block post_startup_script_setup_home %}
/usr/local/bin/start-notebook.sh | tee jupyter-startup.log &
{% endblock %} {% endblock %}