Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples versioning #1019

Merged
merged 5 commits into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
:icons: font

To run any of the examples, replace `k8s-project` with your GCP project ID.
These examples are made to work with the latest release of skaffold.

If you are running skaffold at HEAD or have built it from source, please use the examples at integration/examples.

If you wish to make changes to these examples, please edit the ones at integration/examples, as those will be synced on release.

ifndef::env-github[]

Expand Down
9 changes: 3 additions & 6 deletions examples/annotated-skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v1alpha3
apiVersion: skaffold/v1alpha2
kind: Config
build:
# tagPolicy determines how skaffold is going to tag your images.
Expand Down Expand Up @@ -101,8 +101,7 @@ build:
# See https://github.com/GoogleContainerTools/kaniko#running-kaniko-in-a-kubernetes-cluster
#
# kaniko:
# buildContext:
# gcsBucket: k8s-skaffold
# gcsBucket: k8s-skaffold
# pullSecret: /a/secret/path/serviceaccount.json
# namespace: default
# timeout: 20m
Expand Down Expand Up @@ -147,9 +146,7 @@ deploy:
# releases:
# - name: skaffold-helm
# chartPath: skaffold-helm
# valuesFiles:
# - first-values-file.yaml
# - second-values-file.yaml
# valuesFilePath: helm-skaffold-values.yaml
# values:
# image: skaffold-helm
# namespace: skaffold
Expand Down
2 changes: 1 addition & 1 deletion examples/bazel/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v1alpha3
apiVersion: skaffold/v1alpha2
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion examples/getting-started/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v1alpha3
apiVersion: skaffold/v1alpha2
kind: Config
build:
artifacts:
Expand Down
2 changes: 0 additions & 2 deletions examples/helm-deployment/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ deploy:
namespace: skaffold
values:
image: skaffold-helm
valuesFiles:
- helm-values-file.yaml
```

This part tells skaffold to set the `image` parameter of the values file to the built skaffold-helm image and tag.
Expand Down
5 changes: 2 additions & 3 deletions examples/helm-deployment/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v1alpha3
apiVersion: skaffold/v1alpha2
kind: Config
build:
tagPolicy:
Expand All @@ -11,8 +11,7 @@ deploy:
- name: skaffold-helm
chartPath: skaffold-helm
#wait: true
#valuesFiles:
#- helm-skaffold-values.yaml
#valuesFilePath: helm-skaffold-values.yaml
values:
image: gcr.io/k8s-skaffold/skaffold-helm
#recreatePods will pass --recreate-pods to helm upgrade
Expand Down
5 changes: 2 additions & 3 deletions examples/kaniko/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
apiVersion: skaffold/v1alpha3
apiVersion: skaffold/v1alpha2
kind: Config
build:
artifacts:
- imageName: gcr.io/k8s-skaffold/skaffold-example
kaniko:
buildContext:
gcsBucket: skaffold-kaniko
gcsBucket: skaffold-kaniko
pullSecretName: e2esecret
namespace: default
deploy:
Expand Down
2 changes: 1 addition & 1 deletion examples/kustomize/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v1alpha3
apiVersion: skaffold/v1alpha2
kind: Config
deploy:
kustomize: {}
2 changes: 1 addition & 1 deletion examples/microservices/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v1alpha3
apiVersion: skaffold/v1alpha2
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion examples/tagging-with-environment-variables/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v1alpha3
apiVersion: skaffold/v1alpha2
kind: Config
build:
artifacts:
Expand Down
7 changes: 7 additions & 0 deletions hack/release_notes/release_notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
r2d4 marked this conversation as resolved.
Show resolved Hide resolved
EXAMPLES_DIR=${DIR}/../../examples
INTEGRATION_EXAMPLES_DIR=${DIR}/../../integration/examples

# you can pass your github token with --token here if you run out of requests
go run hack/release_notes/listpullreqs.go

# sync files from integration examples to examples/
rm -rf ${EXAMPLES_DIR} && rm -rf ${INTEGRATION_EXAMPLES_DIR}/bazel/bazel-* && cp -r ${INTEGRATION_EXAMPLES_DIR} ${EXAMPLES_DIR}

echo "Huge thank you for this release towards our contributors: "
git log "$(git describe --abbrev=0)".. --format="%aN" --reverse | sort | uniq | awk '{printf "- %s\n", $0 }'
34 changes: 34 additions & 0 deletions integration/examples/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
== Examples
:icons: font

To run any of the examples, replace `k8s-project` with your GCP project ID.
These examples are made to work with the latest release of skaffold.

If you are running skaffold at HEAD or have built it from source, please use the examples at integration/examples.

If you wish to make changes to these examples, please edit the ones at integration/examples, as those will be synced on release.

ifndef::env-github[]

link:{github-repo-tree}/examples[see on Github icon:github[]]

include::./getting-started/README.adoc[]
include::./microservices/README.adoc[]
include::./tagging-with-environment-variables/README.adoc[]
include::./helm-deployment/README.adoc[]
include::./kustomize/README.adoc[]
include::./kaniko/README.adoc[]
include::./bazel/README.adoc[]
endif::[]

ifdef::env-github[]

- link:./getting-started[]
- link:./microservices[]
- link:./tagging-with-environment-variables[]
- link:./helm-deployment[]
- link:./kustomize[]
- link:./kaniko[]
- link:./bazel[]

endif::[]
179 changes: 179 additions & 0 deletions integration/examples/annotated-skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
apiVersion: skaffold/v1alpha3
kind: Config
build:
# tagPolicy determines how skaffold is going to tag your images.
# We provide a few strategies here, although you most likely won't need to care!
# The policy can `gitCommit`, `sha256` or `envTemplate`.
# If not specified, it defaults to `gitCommit: {}`.
tagPolicy:
# Tag the image with the git commit of your current repository.
gitCommit: {}

# Tag the image with the checksum of the built image (image id).
# sha256: {}

# Tag the image with a configurable template string.
# The template must be in the golang text/template syntax: https://golang.org/pkg/text/template/
# The template is compiled and executed against the current environment,
# with those variables injected:
# IMAGE_NAME | Name of the image being built, as supplied in the artifacts section.
# DIGEST | Digest of the newly built image. For eg. `sha256:27ffc7f352665cc50ae3cbcc4b2725e36062f1b38c611b6f95d6df9a7510de23`.
# DIGEST_ALGO | Algorithm used by the digest: For eg. `sha256`.
# DIGEST_HEX | Digest of the newly built image. For eg. `27ffc7f352665cc50ae3cbcc4b2725e36062f1b38c611b6f95d6df9a7510de23`.
# Example
# envTemplate:
# template: "{{.RELEASE}}-{{.IMAGE_NAME}}"

# Tag the image with the build timestamp.
# The format can be overridden with golang formats, see: https://golang.org/pkg/time/#Time.Format
# Default format is "2006-01-02_15-04-05.999_MST
# The timezone is by default the local timezone, this can be overridden, see https://golang.org/pkg/time/#Time.LoadLocation
# dateTime:
# format: "2006-01-02"
# timezone: "UTC"

# artifacts is a list of the actual images you're going to be building
# you can include as many as you want here.
artifacts:
# The name of the image to be built.
- imageName: gcr.io/k8s-skaffold/skaffold-example
# The path to your dockerfile context. Defaults to ".".
workspace: ../examples/getting-started

# Each artifact is of a given type among: `docker` and `bazel`.
# If not specified, it defaults to `docker: {}`.
docker:
# Dockerfile's location relative to workspace. Defaults to "Dockerfile"
dockerfilePath: Dockerfile
# Key/value arguements passed to the docker build.
buildArgs:
key1: "value1"
key2: "value2"
# Images to consider as cache sources
cacheFrom:
- image1
- image2
# Dockerfile target name to build.
# target: stageName

# bazel requires bazel CLI to be installed and the artifacts sources to
# contain Bazel configuration files.
# bazel:
# target: //:skaffold_example.tar

# This next section is where you'll put your specific builder configuration.
# Valid builders are `local`, `googleCloudBuild` and `kaniko`.
# Defaults to `local: {}`

# Pushing the images can be skipped. If no value is specified, it'll default to
# `true` on minikube or Docker for Desktop, for even faster build and deploy cycles.
# `false` on other types of kubernetes clusters that require pushing the images.
# skaffold defers to your ~/.docker/config for authentication information.
# If you're using Google Container Registry, make sure that you have gcloud and
# docker-credentials-helper-gcr configured correctly.
#
# By default, the local builder connects to the Docker daemon with Go code to build
# images. If `useDockerCLI` is set, skaffold will simply shell out to the docker CLI.
# `useBuildkit` can also be set to activate the experimental BuildKit feature.
#
# local:
# skipPush: true
# useDockerCLI: false
# useBuildkit: false

# Docker artifacts can be built on Google Cloud Build. The projectId then needs
# to be provided and the currently logged user should be given permissions to trigger
# new builds on Cloud Build.
# If the projectId is not provided, Skaffold will try to guess it from the image name.
# For eg. If the artifact image name is gcr.io/myproject/image, then Skaffold will use
# the `myproject` GCP project.
# All the other parameters are also optional. The default values are listed here:
# googleCloudBuild:
# projectId: YOUR_PROJECT
# diskSizeGb: 200
# machineType: "N1_HIGHCPU_8"|"N1_HIGHCPU_32"
# timeout: 10000S
# dockerImage: gcr.io/cloud-builders/docker

# Docker artifacts can be built on a Kubernetes cluster with Kaniko.
# Sources will be sent to a GCS bucket whose name is provided.
# Kaniko also needs access to a service account to push the final image.
# See https://github.com/GoogleContainerTools/kaniko#running-kaniko-in-a-kubernetes-cluster
#
# kaniko:
# buildContext:
# gcsBucket: k8s-skaffold
# pullSecret: /a/secret/path/serviceaccount.json
# namespace: default
# timeout: 20m

# The deploy section has all the information needed to deploy. Along with build:
# it is a required section.
deploy:
# The type of the deployment method can be `kubectl` or `helm`.

# The kubectl deployer uses a client side `kubectl apply` to apply the manifests to the cluster.
# You'll need a kubectl CLI version installed that's compatible with your cluster.
kubectl:
# manifests to deploy from files.
manifests:
- ../examples/getting-started/k8s-*
# kubectl can be passed additional option flags either on every command (Global),
# on creations (Apply) or deletions (Delete).
# flags:
# global: [""]
# apply: [""]
# delete: [""]

# manifests to deploy from remote cluster.
# The path to where these manifests live in remote kubernetes cluster.
# Example
# remoteManifests:
# - deployment/web-app1
# - namespace:deployment/web-app2

# kustomize:
# kustomizePath: "kustomization.yaml"
# kustomize deploys manifests with kubectl.
# kubectl can be passed additional option flags either on every command (Global),
# on creations (Apply) or deletions (Delete).
# flags:
# global: [""]
# apply: [""]
# delete: [""]

# helm:
# helm releases to deploy.
# releases:
# - name: skaffold-helm
# chartPath: skaffold-helm
# valuesFiles:
# - first-values-file.yaml
# - second-values-file.yaml
# values:
# image: skaffold-helm
# namespace: skaffold
# version: ""
# recreatePods: false
#
# # setValues get appended to the helm deploy with --set.
# setValues:
# key: "value"
#
# # packaged section allows to package chart setting specific version
# # and/or appVersion using "helm package" command.
# packaged:
# # version is passed to "helm package --version" flag.
# # Note that you can specify both static string or dynamic template.
# version: {{ .CHART_VERSION }}-dirty
# # appVersion is passed to "helm package --app-version" flag.
# # Note that you can specify both static string or dynamic template.
# appVersion: {{ .CHART_VERSION }}-dirty

# profiles section has all the profile information which can be used to override any build or deploy configuration
profiles:
- name: gcb
build:
googleCloudBuild:
projectId: k8s-skaffold

9 changes: 9 additions & 0 deletions integration/examples/bazel/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
load("@io_bazel_rules_docker//go:image.bzl", "go_image")

go_image(
name = "skaffold_example",
srcs = ["main.go"],
goos = "linux",
goarch = "amd64",
static = "on",
)
42 changes: 42 additions & 0 deletions integration/examples/bazel/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
=== Example: bazel
:icons: font

Bazel is one of the supported builders in Skaffold.
The way you configure it in `skaffold.yaml` is the following build stanza:

[source,yaml]
----
build:
artifacts:
- imageName: gcr.io/k8s-skaffold/skaffold-example
workspace: . <1>
bazel: # <2>
target: //:skaffold_example.tar # <3>
----
<1> make sure the workspace contains the bazel files (`WORKSPACE`, `BUILD`)
<2> add bazel to each artifact
<3> specify target - our builder will use this to load to the image to the Docker daemon

ifndef::env-github[]
==== link:{github-repo-tree}/examples/bazel[Example files icon:github[]]

[source,yaml, indent=3, title=skaffold.yaml]
----
include::skaffold.yaml[]
----

[source,go, indent=3, title=main.go, syntax=go]
----
include::main.go[]
----

[source,bazel, indent=3, title=WORKSPACE]
----
include::WORKSPACE[]
----

[source,bazel, indent=3, title=BUILD]
----
include::BUILD[]
----
endif::[]
Loading