@ship.zone/ci-spec 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/changelog.md +33 -0
  2. package/conformance/compile-cases.json +822 -2
  3. package/conformance/runner-job-cases.json +714 -0
  4. package/conformance/runner-job-cases.schema.json +134 -0
  5. package/conformance/runner-jobs/incoherent/artifact-maximum-above-limit.json +91 -0
  6. package/conformance/runner-jobs/incoherent/build-secret-unknown-target.json +104 -0
  7. package/conformance/runner-jobs/incoherent/cache-count-above-limit.json +91 -0
  8. package/conformance/runner-jobs/incoherent/command-argument-above-limit.json +70 -0
  9. package/conformance/runner-jobs/incoherent/environment-above-limit.json +206 -0
  10. package/conformance/runner-jobs/incoherent/plan-digest-mismatch.json +70 -0
  11. package/conformance/runner-jobs/incoherent/precedence-limit-before-digest.json +70 -0
  12. package/conformance/runner-jobs/incoherent/reserved-prefix-environment.json +71 -0
  13. package/conformance/runner-jobs/incoherent/reserved-prefix-secret-target.json +72 -0
  14. package/conformance/runner-jobs/incoherent/reserved-variable-missing.json +69 -0
  15. package/conformance/runner-jobs/incoherent/reserved-variable-not-canonical.json +70 -0
  16. package/conformance/runner-jobs/incoherent/secret-target-environment-duplicate.json +72 -0
  17. package/conformance/runner-jobs/incoherent/secret-target-without-build-secret.json +101 -0
  18. package/conformance/runner-jobs/incoherent/secret-value-too-short.json +72 -0
  19. package/conformance/runner-jobs/incoherent/shared-memory-above-memory.json +71 -0
  20. package/conformance/runner-jobs/incoherent/source-above-limit.json +70 -0
  21. package/conformance/runner-jobs/invalid/artifacts-feature-missing.json +91 -0
  22. package/conformance/runner-jobs/invalid/artifacts-none-permission.json +91 -0
  23. package/conformance/runner-jobs/invalid/build-without-push-permission.json +100 -0
  24. package/conformance/runner-jobs/invalid/read-write-cache-read-permission.json +91 -0
  25. package/conformance/runner-jobs/invalid/source-feature-missing.json +70 -0
  26. package/conformance/runner-jobs/invalid/vm-without-platform.json +81 -0
  27. package/dist_ts/00_commitinfo_data.js +1 -1
  28. package/dist_ts/constants.d.ts +42 -0
  29. package/dist_ts/constants.js +57 -1
  30. package/package.json +4 -2
  31. package/readme.md +13 -4
  32. package/spec/ci-actions.md +12 -5
  33. package/spec/runner-protocol.md +32 -1
  34. package/spec/runner.openapi.json +1 -1
  35. package/ts/00_commitinfo_data.ts +1 -1
  36. package/ts/constants.ts +65 -0
package/ts/constants.ts CHANGED
@@ -94,6 +94,69 @@ export const compilationFailureCodes = [
94
94
  { code: 'secret_too_short', layer: 'run' },
95
95
  ] as const;
96
96
 
97
+ /**
98
+ * The prefix of every environment name the specification reserves (spec/ci-actions.md, Jobs and
99
+ * Steps; spec/runner-protocol.md, OCI Container Profile): workflow authors cannot define a name
100
+ * with it, and a compiled job carries only the reserved step variables with it.
101
+ */
102
+ export const reservedEnvironmentPrefix = 'SHIPZONE_CI_' as const;
103
+
104
+ /** The matrix values of a compiled step, as RFC 8785 JSON object text (spec/ci-actions.md, Matrix). */
105
+ export const matrixEnvironmentName = 'SHIPZONE_CI_MATRIX_JSON' as const;
106
+
107
+ /** The manual inputs of a run, as RFC 8785 JSON object text (spec/ci-actions.md, Matrix). */
108
+ export const inputsEnvironmentName = 'SHIPZONE_CI_INPUTS_JSON' as const;
109
+
110
+ /**
111
+ * The reserved variables every compiled `oci` and `vm` step carries (spec/runner-protocol.md, OCI
112
+ * Container Profile).
113
+ */
114
+ export const reservedStepEnvironmentNames = [matrixEnvironmentName, inputsEnvironmentName] as const;
115
+
116
+ /**
117
+ * The environment name through which a runner delivers npm read grants to `oci` and `vm` steps,
118
+ * reserved in a job with `npmRead` (spec/runner-protocol.md, npm Read Grants).
119
+ */
120
+ export const npmUserConfigEnvironmentName = 'NPM_CONFIG_USERCONFIG' as const;
121
+
122
+ /**
123
+ * The BuildKit secret id through which a runner delivers npm read grants to an `oci-image` build,
124
+ * reserved in a job with `npmRead` (spec/runner-protocol.md, npm Read Grants).
125
+ */
126
+ export const npmBuildSecretId = 'npmrc' as const;
127
+
128
+ /** The prefix of the image label keys reserved for the coordinator (spec/ci-actions.md, Image Builds). */
129
+ export const reservedImageLabelPrefix = 'zone.ship.ci.' as const;
130
+
131
+ /**
132
+ * The image label keys reserved for the coordinator besides the reserved prefix (spec/ci-actions.md,
133
+ * Image Builds). The coordinator compiles `revision` and `source` into every build job and `version`
134
+ * on a run with a tag version (spec/ci-actions.md, Compiled Jobs).
135
+ */
136
+ export const reservedImageLabelKeys = [
137
+ 'org.opencontainers.image.revision',
138
+ 'org.opencontainers.image.source',
139
+ 'org.opencontainers.image.version',
140
+ ] as const;
141
+
142
+ /**
143
+ * Every runner job failure code in precedence order, mirrored from
144
+ * `conformance/runner-job-cases.json` `failureCodes`: the code a coordinator or runner reports for a
145
+ * compiled job that is not coherent (spec/runner-protocol.md, Job Coherence). The conformance tests
146
+ * assert both sources and the prose table agree.
147
+ */
148
+ export const runnerJobFailureCodes = [
149
+ 'spec_incompatible',
150
+ 'job_schema_invalid',
151
+ 'job_secret_incoherent',
152
+ 'job_limit_incoherent',
153
+ 'job_resources_incoherent',
154
+ 'job_environment_incoherent',
155
+ 'job_command_limit_exceeded',
156
+ 'job_secret_inadmissible',
157
+ 'job_digest_mismatch',
158
+ ] as const;
159
+
97
160
  export const ciSpecAssetPaths = {
98
161
  runnerOpenApi: 'spec/runner.openapi.json',
99
162
  runnerProtocol: 'spec/runner-protocol.md',
@@ -107,6 +170,8 @@ export const ciSpecAssetPaths = {
107
170
  versionCases: 'conformance/version-cases.json',
108
171
  compileCases: 'conformance/compile-cases.json',
109
172
  compileCasesSchema: 'conformance/compile-cases.schema.json',
173
+ runnerJobCases: 'conformance/runner-job-cases.json',
174
+ runnerJobCasesSchema: 'conformance/runner-job-cases.schema.json',
110
175
  ciActionsConformanceDirectory: 'conformance/ci-actions',
111
176
  runnerJobConformanceDirectory: 'conformance/runner-jobs',
112
177
  } as const;