From 430f7b4ac1e1ae7a085a2202e2ce7080a6f88126 Mon Sep 17 00:00:00 2001 From: Tiffany Kyi Date: Fri, 26 Feb 2021 11:18:54 -0800 Subject: [PATCH] feat(2331): Add locked step --- docs/user-guide/templates.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/templates.md b/docs/user-guide/templates.md index 13c8ee28..91e0f195 100644 --- a/docs/user-guide/templates.md +++ b/docs/user-guide/templates.md @@ -39,6 +39,9 @@ toc: - title: Template steps url: "#template-steps" subitem: level-2 + - title: Template locked steps + url: "#template-locked-steps" + subitem: level-2 - title: Template composition url: "#template-composition" subitem: true @@ -163,7 +166,9 @@ jobs: This will run the command `echo skip installing` for the `install` step. -You can also replace the image defined in the template. Some template steps might rely on commands or environment invariants that your image may not have, so be careful when replacement. +Note: You cannot replace a [locked step](#template-locked-steps). + +You can also replace the image defined in the template. Some template steps might rely on commands or environment invariants that your image may not have, so be careful when replacing. Example: ```yaml @@ -375,6 +380,22 @@ jobs: ``` It becomes unclear whether the user was trying to override `preinstall` or wrap `install`. +#### Template Locked Steps +You can specify steps that cannot be overwritten and must be included when using `order` by adding a `locked` key to your steps. It expects a boolean value (`true`/`false`; default is `false`). +This flag applies to any template or job that uses this template. All templates using a template with a `locked` step will also have the same locked step. + +```yaml +config: + image: node:12 + steps: + - preinstall: echo Installing + - install: npm install + - test: + command: npm test + locked: true +``` + + ### Template Composition You can also use a template in the `config` section of an `sd-template.yaml` file.