You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/en/docs/workflows/ci-cd.md
+28-12
Original file line number
Diff line number
Diff line change
@@ -6,25 +6,40 @@ weight: 3
6
6
7
7
Skaffold offers several sub-commands for its workflows that make it quite flexible when integrating with CI/CD pipelines.
8
8
9
-
## `skaffold build` | `skaffold deploy`
9
+
## `skaffold build | skaffold deploy`
10
10
11
11
`skaffold build` will build your project's artifacts, and push the build images to the specified registry. If your project is already configured to run with Skaffold, `skaffold build` can be a very lightweight way of setting up builds for your CI pipeline. Passing the `--file-output` flag to Skaffold build will also write out your built artifacts in JSON format to a file on disk, which can then by passed to `skaffold deploy` later on. This is a great way of "committing" your artifacts when they have reached a state that you're comfortable with, especially for projects with multiple artifacts for multiple services.
12
12
13
13
Example using the current git state as a unique file ID to "commit" build state:
14
14
15
-
```code
16
-
➜ getting-started git:(docs) ✗ export STATE=$(git rev-list -1 HEAD --abbrev-commit)
`skaffold dev` enables continuous local development on an application.
10
8
While in `dev` mode, Skaffold will watch an application's source files, and when it detects changes,
11
9
will rebuild your images (or sync files to your running containers), push any new images, and redeploy the application to your cluster.
12
10
13
11
`skaffold dev` is considered Skaffold's main mode of operation, as it allows you
14
-
to leverage all of the main features of Skaffold in a continuous way while iterating
12
+
to leverage all of the features of Skaffold in a continuous way while iterating
15
13
on your application.
16
14
17
-
18
15
## Dev loop
19
16
20
-
When `skaffold dev` is run, Skaffold will first do a full build and deploy of all artifacts specified in the `skaffold.yaml`, identical behavior to `skaffold run`. Upon successful build and deploy, Skaffold will start watching all source file dependencies for all artifacts specified in the project. As changes are made to these source files, Skaffold will rebuild the associated artifacts, and redeploy the new changes to your cluster.
21
-
22
-
The dev loop will run until the user cancels the Skaffold process with `Ctrl+C`. Upon receiving this signal, Skaffold will clean up all deployed artifacts on the active cluster, meaning that Skaffold won't abandon any Kubernetes resources that it created throughout the lifecycle of the run.
17
+
When `skaffold dev` is run, Skaffold will first do a full build and deploy of all artifacts specified in the `skaffold.yaml`, similar to `skaffold run`. Upon successful build and deploy, Skaffold will start watching all source file dependencies for all artifacts specified in the project. As changes are made to these source files, Skaffold will rebuild the associated artifacts, and redeploy the new changes to your cluster.
23
18
19
+
The dev loop will run until the user cancels the Skaffold process with `Ctrl+C`. Upon receiving this signal, Skaffold will clean up all deployed artifacts on the active cluster, meaning that Skaffold won't abandon any Kubernetes resources that it created throughout the lifecycle of the run. This can be optionally disabled by using the `--no-prune` flag.
24
20
25
21
## Precedence of Actions
26
22
27
23
The actions performed by Skaffold during the dev loop have precendence over one another, so that behavior is always predictable. The order of actions is:
28
24
29
-
1) File Sync
30
-
1) Build
31
-
1) Deploy
32
-
25
+
1. File Sync
26
+
1. Build
27
+
1. Deploy
33
28
34
29
## File Watcher and Watch Modes
35
30
36
31
Skaffold computes the dependencies for each artifact based on the builder being used, and the root directory of the artifact. Once all source file dependencies are computed, in `dev` mode, Skaffold will continuously watch these files for changes in the background, and conditionally re-run the loop when changes are detected.
37
32
38
33
By default, Skaffold uses `fsnotify` to monitor events on the local filesystem. Skaffold also supports a `polling` mode where the filesystem is checked for changes on a configurable interval, or a `manual` mode, where Skaffold waits for user input to check for file changes. These watch modes can be configured through the `--trigger` flag.
39
34
40
-
41
35
## Control API
42
36
43
37
By default, the dev loop will carry out all actions (as needed) each time a file is changed locally, with the exception of operating in `manual` trigger mode. However, individual actions can be gated off by user input through the Control API.
0 commit comments