github.com/GoogleContainerTools/skaffold@v1.39.18/examples/lifecycle-hooks/skaffold.yaml (about) 1 apiVersion: skaffold/v2beta28 2 kind: Config 3 build: 4 artifacts: 5 - image: hooks-example 6 hooks: 7 before: 8 - command: ["sh", "-c", "./hook.sh"] 9 os: [darwin, linux] 10 dir: . 11 - command: ["cmd.exe", "/C", "hook.bat"] 12 os: [windows] 13 dir: . 14 after: 15 - command: ["sh", "-c", "docker images $SKAFFOLD_IMAGE --digests"] 16 os: [darwin, linux] 17 - command: ["cmd.exe", "/C", "docker images %SKAFFOLD_IMAGE% --digests"] 18 os: [windows] 19 sync: 20 manual: 21 - src: 'hello.txt' 22 dest: . 23 hooks: 24 before: 25 - host: 26 command: ["sh", "-c", "echo file changes detected: $SKAFFOLD_FILES_ADDED_OR_MODIFIED"] 27 os: [darwin, linux] 28 - host: 29 command: ["cmd.exe", "/C", "echo file changes detected: %SKAFFOLD_FILES_ADDED_OR_MODIFIED%"] 30 os: [windows] 31 after: 32 - container: 33 command: ["sh", "-c", "set -x; kill -HUP 1"] 34 deploy: 35 kubectl: 36 manifests: 37 - deployment.yaml 38 hooks: 39 before: 40 - host: 41 command: ["sh", "-c", "echo pre-deploy host hook running on $(hostname)!"] 42 os: [darwin, linux] 43 - container: 44 # this will only run when there's a matching container from a previous deploy iteration like in `skaffold dev` 45 command: ["sh", "-c", "echo pre-deploy container hook running on $(hostname)!"] 46 containerName: hooks-example* 47 podName: hooks-example-deployment* 48 after: 49 - host: 50 command: ["sh", "-c", "echo post-deploy host hook running on $(hostname)!"] 51 - container: 52 command: ["sh", "-c", "echo post-deploy container hook running on $(hostname)!"] 53 containerName: hooks-example* # use a glob pattern to prefix-match the container name and pod name for deployments, stateful-sets, etc. 54 podName: hooks-example-deployment*