Skip to content

Commit 00c114f

Browse files
authored
Reorganize using a Skaffold multi-config setup (#65)
Using Skaffold multi-config allows working on individual language runtimes independently.
1 parent f81a998 commit 00c114f

37 files changed

+402
-164
lines changed

.travis.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
sudo: false
22
dist: bionic
3-
lang: bash
3+
language: go
4+
go: "1.15.x"
5+
46
services:
57
- docker
68

@@ -10,14 +12,16 @@ before_install:
1012

1113
install:
1214
- mkdir -p $HOME/bin
13-
- curl -Lo $HOME/bin/skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
15+
- curl -Lo $HOME/bin/skaffold https://storage.googleapis.com/skaffold/builds/latest/skaffold-linux-amd64
1416
- curl -Lo $HOME/bin/container-structure-test https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64
1517
- curl -Lo $HOME/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.9.0/kind-linux-amd64
1618
- curl -Lo $HOME/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
1719
- chmod +x $HOME/bin/*
1820
- export PATH=$HOME/bin:$PATH
1921

2022
script:
23+
- (cd nodejs/helper-image; go test .)
24+
# try building before integration tests
2125
- skaffold build -p local
2226

2327
# Create a kind configuration to use the docker daemon's configured

buildx.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
#
3+
# Skaffold Custom Builder that uses `docker buildx` to perform a
4+
# multi-platform build.
5+
6+
PLATFORMS=linux/amd64,linux/arm64
7+
8+
if ! docker buildx inspect skaffold-builder >/dev/null 2>&1; then
9+
echo ">> creating "docker buildx" builder 'skaffold-builder'"
10+
docker buildx create --name skaffold-builder --platform $PLATFORMS
11+
fi
12+
13+
loadOrPush=$(if [ "$PUSH_IMAGE" = true ]; then echo --platform $PLATFORMS --push; else echo --load; fi)
14+
15+
set -x
16+
docker buildx build \
17+
--progress=plain \
18+
--builder skaffold-builder \
19+
$loadOrPush \
20+
--tag $IMAGE \
21+
"$BUILD_CONTEXT"
22+
File renamed without changes.
File renamed without changes.
File renamed without changes.

go/skaffold.yaml

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
apiVersion: skaffold/v2beta13
2+
kind: Config
3+
metadata:
4+
name: go
5+
6+
requires:
7+
- path: ../integration
8+
activeProfiles:
9+
- name: integration
10+
activatedBy: [integration]
11+
12+
build:
13+
local:
14+
useBuildkit: true
15+
artifacts:
16+
- image: skaffold-debug-go
17+
context: helper-image
18+
custom:
19+
buildCommand: ../../buildx.sh
20+
21+
test:
22+
- image: skaffold-debug-go
23+
structureTests: [structure-tests-go.yaml]
24+
25+
deploy:
26+
logs:
27+
prefix: auto
28+
kubectl:
29+
manifests: [] # overwritten in integration profile
30+
31+
profiles:
32+
33+
# local: never push to remote registries
34+
- name: local
35+
build:
36+
local:
37+
push: false
38+
39+
# integration: set of `skaffold debug`-like integration tests
40+
- name: integration
41+
patches:
42+
- op: add
43+
path: /build/artifacts/-
44+
value:
45+
image: go113app
46+
context: test/goapp
47+
docker:
48+
buildArgs:
49+
GOVERSION: 1.13
50+
- op: add
51+
path: /build/artifacts/-
52+
value:
53+
image: go114app
54+
context: test/goapp
55+
docker:
56+
buildArgs:
57+
GOVERSION: 1.14
58+
- op: add
59+
path: /build/artifacts/-
60+
value:
61+
image: go115app
62+
context: test/goapp
63+
docker:
64+
buildArgs:
65+
GOVERSION: 1.15
66+
- op: add
67+
path: /build/artifacts/-
68+
value:
69+
image: go116app
70+
context: test/goapp
71+
docker:
72+
buildArgs:
73+
GOVERSION: 1.16
74+
deploy:
75+
kubectl:
76+
manifests:
77+
- test/k8s-test-go113.yaml
78+
- test/k8s-test-go114.yaml
79+
- test/k8s-test-go115.yaml
80+
- test/k8s-test-go116.yaml
81+
82+
# release: pushes images to production with :latest
83+
- name: release
84+
build:
85+
local:
86+
push: true
87+
tagPolicy:
88+
sha256: {}
89+
90+
# deprecated-names: use short (deprecated) image names: images were
91+
# prefixed with `skaffold-debug-` so they were more easily distinguished
92+
# from other images with similar names.
93+
- name: deprecated-names
94+
patches:
95+
- op: replace
96+
path: /build/artifacts/0/image
97+
from: skaffold-debug-go
98+
value: go
99+
- op: replace
100+
path: /test/0/image
101+
from: skaffold-debug-go
102+
value: go
103+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

integration/skaffold.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: skaffold/v2beta13
2+
kind: Config
3+
metadata:
4+
name: integration
5+
6+
build:
7+
local:
8+
useBuildkit: true
9+
10+
deploy:
11+
logs:
12+
prefix: auto
13+
kubectl:
14+
manifests: []
15+
16+
profiles:
17+
# integration: set of `skaffold debug`-like integration tests
18+
- name: integration
19+
build:
20+
artifacts:
21+
- image: kubectl
22+
context: kubectl
23+
docker:
24+
buildArgs:
25+
GOVERSION: 1.16
26+
deploy:
27+
kubectl:
28+
manifests:
29+
- k8s-rbac.yaml
30+
File renamed without changes.
File renamed without changes.

netcore/skaffold.yaml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
apiVersion: skaffold/v2beta13
2+
kind: Config
3+
metadata:
4+
name: netcore
5+
6+
requires:
7+
- path: ../integration
8+
activeProfiles:
9+
- name: integration
10+
activatedBy: [integration]
11+
12+
build:
13+
local:
14+
useBuildkit: true
15+
artifacts:
16+
- image: skaffold-debug-netcore
17+
context: helper-image
18+
custom:
19+
buildCommand: ../../buildx.sh
20+
21+
test:
22+
- image: skaffold-debug-netcore
23+
structureTests: [structure-tests-netcore.yaml]
24+
25+
deploy:
26+
logs:
27+
prefix: auto
28+
kubectl:
29+
manifests: []
30+
31+
profiles:
32+
33+
# local: never push to remote registries
34+
- name: local
35+
build:
36+
local:
37+
push: false
38+
39+
# integration: set of `skaffold debug`-like integration tests
40+
- name: integration
41+
# No integration tests for netcore yet
42+
43+
# release: pushes images to production with :latest
44+
- name: release
45+
build:
46+
local:
47+
push: true
48+
tagPolicy:
49+
sha256: {}
50+
51+
# deprecated-names: use short (deprecated) image names: images were
52+
# prefixed with `skaffold-debug-` so they were more easily distinguished
53+
# from other images with similar names.
54+
- name: deprecated-names
55+
patches:
56+
- op: replace
57+
path: /build/artifacts/0/image
58+
from: skaffold-debug-netcore
59+
value: netcore
60+
- op: replace
61+
path: /test/0/image
62+
from: skaffold-debug-netcore
63+
value: netcore
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

nodejs/skaffold.yaml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
apiVersion: skaffold/v2beta13
2+
kind: Config
3+
metadata:
4+
name: nodejs
5+
6+
requires:
7+
- path: ../integration
8+
activeProfiles:
9+
- name: integration
10+
activatedBy: [integration]
11+
12+
build:
13+
local:
14+
useBuildkit: true
15+
artifacts:
16+
- image: skaffold-debug-nodejs
17+
context: helper-image
18+
custom:
19+
buildCommand: ../../buildx.sh
20+
21+
test:
22+
- image: skaffold-debug-nodejs
23+
structureTests: [structure-tests-nodejs.yaml]
24+
# Disabled custom test pending Skaffold #5665 and #5666
25+
##custom:
26+
## - command: "cd helper-image; go test ."
27+
## dependencies:
28+
## paths: ["helper-image/*.go", "helper-image/go.*"]
29+
30+
deploy:
31+
logs:
32+
prefix: auto
33+
kubectl:
34+
manifests: []
35+
36+
profiles:
37+
38+
# local: never push to remote registries
39+
- name: local
40+
build:
41+
local:
42+
push: false
43+
44+
# integration: set of `skaffold debug`-like integration tests
45+
- name: integration
46+
patches:
47+
- op: add
48+
path: /build/artifacts/-
49+
value:
50+
image: nodejs12app
51+
context: test/nodejsapp
52+
docker:
53+
buildArgs:
54+
NODEVERSION: 12.16.0
55+
deploy:
56+
kubectl:
57+
manifests:
58+
- test/k8s-test-nodejs12.yaml
59+
60+
# release: pushes images to production with :latest
61+
- name: release
62+
build:
63+
local:
64+
push: true
65+
tagPolicy:
66+
sha256: {}
67+
68+
# deprecated-names: use short (deprecated) image names: images were
69+
# prefixed with `skaffold-debug-` so they were more easily distinguished
70+
# from other images with similar names.
71+
- name: deprecated-names
72+
patches:
73+
- op: replace
74+
path: /build/artifacts/0/image
75+
from: skaffold-debug-nodejs
76+
value: nodejs
77+
- op: replace
78+
path: /test/0/image
79+
from: skaffold-debug-nodejs
80+
value: nodejs
81+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

publish.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ set -eu
66
# https://github.com/GoogleContainerTools/skaffold/issues/5504
77

88
# publish with longer image names
9-
skaffold build -p prod --default-repo gcr.io/k8s-skaffold/skaffold-debug-support --cache-artifacts=false
10-
skaffold build -p prod --default-repo gcr.io/gcp-dev-tools/duct-tape
9+
skaffold build -p release --default-repo gcr.io/k8s-skaffold/skaffold-debug-support --cache-artifacts=false
10+
skaffold build -p release --default-repo gcr.io/gcp-dev-tools/duct-tape
1111

1212
# the github project packages is a backup location; will need to
1313
# migrate to ghcr.io/googlecontainertools at some point
14-
skaffold build -p prod --default-repo docker.pkg.github.com/googlecontainertools/skaffold
14+
skaffold build -p release --default-repo docker.pkg.github.com/googlecontainertools/skaffold
1515

1616
# publish with shorter (deprecated) image names
17-
skaffold build -p prod,deprecated-names --default-repo gcr.io/k8s-skaffold/skaffold-debug-support
18-
skaffold build -p prod,deprecated-names --default-repo gcr.io/gcp-dev-tools/duct-tape
17+
skaffold build -p release,deprecated-names --default-repo gcr.io/k8s-skaffold/skaffold-debug-support
18+
skaffold build -p release,deprecated-names --default-repo gcr.io/gcp-dev-tools/duct-tape
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)