scaleway/job-definition v0.1.0
This implements LIB-0053 (noisypigeon/runway#191). runway doesn't use it yet: that comes after the release.
The new module, tools/terraform/scaleway/job-definition (scaleway ~> 2.89):
- It wraps
scaleway_job_definition. Inputs are named for the entry keys:image(pinned tag or digest, validated),command,args,cpu,memory,storage,timeout,schedule,timezoneandenv. schedulebecomes the definition'scron, so Scaleway starts the runs. Without it the job is ad hoc.secret_envandsecret_wiringbecome onescaleway_secretand version each, and reach the run as environment variables throughsecret_reference, never as plainenv.- Outputs are
id,nameandrecurring. The README carries the docs markers thatmodule-docs.ymlfills on main.
The kind, scaleway.job.<k>, in root.hcl and its twin resolve-workloads.sh:
envvalues come in three forms:- plain values, which go to
env; {secretRef: NAME}fromsecrets.workload.yaml, which goes tosecret_env;{apiKey: <key>, field: access_key|secret_key}, which goes tosecret_wiring. The stub fills it from thatscaleway.iam.apiKeyleaf, as an instance's keyring is wired.
- plain values, which go to
job-runner: any job implies ajob-runnerapplication, a policy grantingServerlessJobsFullAccesson the workload's project only, and a key, all signed in with the spoke's key.job-runneris reserved.- Validation:
- a pinned image;
- kebab-case names;
project_idcan't be set;- each
envvalue must be a value, a secretRef or a known apiKey with a valid field; - a missing secretRef is refused in
root.hcl.
Ad-hoc runs, tools/github/workflows/scaleway-job-run.yml:
- Inputs:
unit_dir,job, and optionalargs(JSON array) andenv(JSON object). - It reads the job's ID and the
job-runnerkey from state, assite-r2.ymldoes. - It starts one run through the Serverless Jobs v1alpha2 API, then polls until
succeeded,failedorinterrupted. - The request and run-state shapes are taken from Scaleway's Go SDK.
Garden lists the module, so its inputs.schema.json is generated on release.
How I checked it:
- Two new generator tests:
- a job with apiKey env generates its definition stub, the
apikey_readerdependency, bothsecret_wiringentries, and the threejob-runnerleaves; - an unpinned image and a declared
job-runnerkey are refused.
- a job with apiKey env generates its definition stub, the
- The script tests pass, apart from the two
check-policiescases that also fail onmainin this sandbox. - runway's own stubs are unchanged.
root.hclparses.- The module passes
terraform fmt.terraform validatecouldn't run here because the provider registry is unreachable, so the schema was checked against the provider's docs at v2.89.0.
Release: release:minor. That releases github/terragrunt and github/workflows, and starts the new track terraform/scaleway/job-definition at v0.1.0. Nothing plans here.
Generated by Claude Code
PR: https://github.com/noisypigeon/runway/pull/192