Skip to content

Commit a6803f8

Browse files
balopatnkubala
authored andcommitted
nits
1 parent a9d11a0 commit a6803f8

File tree

3 files changed

+34
-25
lines changed

3 files changed

+34
-25
lines changed

docs/content/en/docs/workflows/ci-cd.md

+28-12
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,40 @@ weight: 3
66

77
Skaffold offers several sub-commands for its workflows that make it quite flexible when integrating with CI/CD pipelines.
88

9-
## `skaffold build` | `skaffold deploy`
9+
## `skaffold build | skaffold deploy`
1010

1111
`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.
1212

1313
Example using the current git state as a unique file ID to "commit" build state:
1414

15-
```code
16-
➜ getting-started git:(docs) ✗ export STATE=$(git rev-list -1 HEAD --abbrev-commit)
17-
18-
➜ getting-started skaffold build --file-output build-$STATE.json
15+
Storing the build result in a commit specific JSON file:
16+
```bash
17+
export STATE=$(git rev-list -1 HEAD --abbrev-commit)
18+
skaffold build --file-output build-$STATE.json
19+
```
20+
outputs:
21+
```bash
1922
Generating tags...
2023
- gcr.io/k8s-skaffold/skaffold-example:v0.41.0-17-g3ad238db
2124
Checking cache...
2225
- gcr.io/k8s-skaffold/skaffold-example: Found. Tagging
26+
```
2327

24-
➜ getting-started cat build-$STATE.json
28+
The content of the JSON file
29+
```bash
30+
cat build-$STATE.json
31+
```
32+
outputs:
33+
```json
2534
{"builds":[{"imageName":"gcr.io/k8s-skaffold/skaffold-example","tag":"gcr.io/k8s-skaffold/skaffold-example:v0.41.0-17-g3ad238db@sha256:eeffb639f53368c4039b02a4d337bde44e3acc728b309a84353d4857ee95c369"}]}
35+
```
2636

27-
➜ getting-started git:(docs) ✗ skaffold deploy -a build-$STATE.json
37+
We can use this build result file to deploy:
38+
```bash
39+
skaffold deploy -a build-$STATE.json
40+
```
41+
Outputs:
42+
```bash
2843
Tags used in deployment:
2944
- gcr.io/k8s-skaffold/skaffold-example -> gcr.io/k8s-skaffold/skaffold-example:v0.41.0-17-g3ad238db@sha256:eeffb639f53368c4039b02a4d337bde44e3acc728b309a84353d4857ee95c369
3045
Starting deploy...
@@ -37,9 +52,8 @@ Skaffold also has another built-in command, `skaffold render`, that will perform
3752

3853
Example of running `skaffold render` to render Kubernetes manifests, then sending them directly to `kubectl`:
3954

40-
```code
41-
➜ getting-started skaffold render --output render.txt
42-
➜ getting-started cat render.txt
55+
Running `skaffold render --output render.txt && cat render.txt` outputs:
56+
```yaml
4357
apiVersion: v1
4458
kind: Pod
4559
metadata:
@@ -49,14 +63,16 @@ spec:
4963
containers:
5064
- image: gcr.io/k8s-skaffold/skaffold-example:v0.41.0-57-gbee90013@sha256:eeffb639f53368c4039b02a4d337bde44e3acc728b309a84353d4857ee95c369
5165
name: getting-started
66+
```
5267
53-
➜ getting-started cat render.txt | kubectl apply -f -
68+
We can then pipe this yaml to kubectl ` cat render.txt | kubectl apply -f -`:
69+
```
5470
pod/getting-started configured
5571
```
5672
5773
Or, skipping the file writing altogether:
5874
5975
```code
60-
➜ getting-started skaffold render | kubectl apply -f -
76+
skaffold render | kubectl apply -f -
6177
pod/getting-started configured
6278
```

docs/content/en/docs/workflows/dev.md

+6-12
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,34 @@ linkTitle: "Continuous development"
44
weight: 1
55
---
66

7-
## `skaffold dev`
8-
97
`skaffold dev` enables continuous local development on an application.
108
While in `dev` mode, Skaffold will watch an application's source files, and when it detects changes,
119
will rebuild your images (or sync files to your running containers), push any new images, and redeploy the application to your cluster.
1210

1311
`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
1513
on your application.
1614

17-
1815
## Dev loop
1916

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.
2318

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.
2420

2521
## Precedence of Actions
2622

2723
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:
2824

29-
1) File Sync
30-
1) Build
31-
1) Deploy
32-
25+
1. File Sync
26+
1. Build
27+
1. Deploy
3328

3429
## File Watcher and Watch Modes
3530

3631
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.
3732

3833
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.
3934

40-
4135
## Control API
4236

4337
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.

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ require (
4646
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
4747
github.com/golang/groupcache v0.0.0-20191002201903-404acd9df4cc // indirect
4848
github.com/golang/protobuf v1.3.2
49-
github.com/google/btree v1.0.0 // indirect
5049
github.com/google/go-cmp v0.3.1
5150
github.com/google/go-containerregistry v0.0.0-20191017210159-68bc585818ee
5251
github.com/google/go-github v17.0.0+incompatible

0 commit comments

Comments
 (0)