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

Lines changed: 6 additions & 2 deletions
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

Lines changed: 22 additions & 0 deletions
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.

go/skaffold.yaml

Lines changed: 103 additions & 0 deletions
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+

0 commit comments

Comments
 (0)