Skip to content

Commit

Permalink
chore: upgrade v2.0 deps (#8619)
Browse files Browse the repository at this point in the history
* upgrade v2.0 deps

* chore: fix test

* chore: fix bazel example

* chore: upgrade go version

* chore: update skaffold config api version

* chore: update skaffold config api version in bazel example

* chore: cloud build config

* chore: go mod tidy
  • Loading branch information
ericzzzzzzz authored Apr 5, 2023
1 parent 3d29363 commit eba7c3b
Show file tree
Hide file tree
Showing 61 changed files with 1,817 additions and 2,733 deletions.
12 changes: 6 additions & 6 deletions cmd/skaffold/app/cmd/config/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ default-repo: value
multi-level-repo: true
local-cluster: true
insecure-registries:
- bad.io
- worse.io
- bad.io
- worse.io
`,
},
{
Expand All @@ -90,7 +90,7 @@ insecure-registries:
multi-level-repo: true
local-cluster: true
insecure-registries:
- mediocre.io
- mediocre.io
`,
},
{
Expand All @@ -116,10 +116,10 @@ global:
multi-level-repo: true
local-cluster: true
insecure-registries:
- mediocre.io
- mediocre.io
kubeContexts:
- kube-context: this_is_a_context
default-repo: value
- kube-context: this_is_a_context
default-repo: value
`,
},
{
Expand Down
2 changes: 1 addition & 1 deletion cmd/skaffold/app/cmd/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ spec:
var b bytes.Buffer
err := runFilter(context.TODO(), &b, false, test.buildArtifacts)
t.CheckNoError(err)
t.CheckDeepEqual(test.expected, b.String())
t.CheckDeepEqual(test.expected, b.String(), testutil.YamlObj(t.T))
})
}
}
11 changes: 8 additions & 3 deletions cmd/skaffold/app/cmd/fix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"os"
"testing"

"github.com/google/go-cmp/cmp"

"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
v1 "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/v1"
"github.com/GoogleContainerTools/skaffold/testutil"
Expand All @@ -34,10 +36,12 @@ func TestFix(t *testing.T) {
targetVersion string
output string
shouldErr bool
cmpOptions cmp.Options
}{
{
description: "v1alpha4 to latest",
targetVersion: latest.Version,
cmpOptions: []cmp.Option{testutil.YamlObj(t)},
inputYaml: `apiVersion: skaffold/v1alpha4
kind: Config
build:
Expand Down Expand Up @@ -75,6 +79,7 @@ deploy:
{
description: "v1alpha1 to latest",
targetVersion: latest.Version,
cmpOptions: []cmp.Option{testutil.YamlObj(t)},
inputYaml: `apiVersion: skaffold/v1alpha1
kind: Config
build:
Expand Down Expand Up @@ -104,6 +109,7 @@ deploy:
{
description: "v1alpha1 to v1",
targetVersion: v1.Version,
cmpOptions: []cmp.Option{testutil.YamlObj(t)},
inputYaml: `apiVersion: skaffold/v1alpha1
kind: Config
build:
Expand Down Expand Up @@ -161,8 +167,7 @@ build:

var b bytes.Buffer
err := fix(&b, cfgFile, "", test.targetVersion)

t.CheckErrorAndDeepEqual(test.shouldErr, err, test.output, b.String())
t.CheckErrorAndDeepEqual(test.shouldErr, err, test.output, b.String(), test.cmpOptions)
})
}
}
Expand Down Expand Up @@ -211,6 +216,6 @@ deploy:
output, _ := os.ReadFile(cfgFile)

t.CheckNoError(err)
t.CheckDeepEqual(expectedOutput, string(output))
t.CheckDeepEqual(expectedOutput, string(output), testutil.YamlObj(t.T))
})
}
77 changes: 45 additions & 32 deletions deploy/cloudbuild-release-lts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,67 @@
# see: https://cloud.google.com/container-builder/docs/configuring-builds/substitute-variable-values#using_default_substitutions
steps:

# Build and tag skaffold-deps image using docker with cache-from
# Build and tag skaffold-deps image using docker with cache-from
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/build_deps:latest-lts'
- '--cache-from'
- 'gcr.io/k8s-skaffold/build_deps:latest-lts'
- '-f'
- 'deploy/skaffold/Dockerfile.deps.lts'
- '.'

# Grab secret credentials from gcp bucket
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/build_deps:latest-lts'
- '--cache-from'
- 'gcr.io/k8s-skaffold/build_deps:latest-lts'
- '-f'
- 'deploy/skaffold/Dockerfile.deps.lts'
- '.'

# Grab secret credentials from gcp bucket
- name: gcr.io/cloud-builders/gcloud
entrypoint: 'bash'
args: ['deploy/setup-secret.sh','-p', $PROJECT_ID]

# Build and tag skaffold builder
# Build and tag skaffold builder
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '--cache-from'
- 'gcr.io/$PROJECT_ID/skaffold-builder:latest'
- '-t'
- 'gcr.io/$PROJECT_ID/skaffold-builder:latest'
- '-f'
- 'deploy/skaffold/Dockerfile'
- '.'

# Do the go build & push the results to GCS
- 'build'
- '--cache-from'
- 'gcr.io/$PROJECT_ID/skaffold-builder:latest'
- '-t'
- 'gcr.io/$PROJECT_ID/skaffold-builder:latest'
- '-f'
- 'deploy/skaffold/Dockerfile'
- '.'

# Build and tag distroless-skaffold image for scanning
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '--build-arg'
- 'PROJECT_ID=$PROJECT_ID'
- '-t'
- 'us-east1-docker.pkg.dev/$PROJECT_ID/scanning/skaffold:$TAG_NAME-lts'
- '-f'
- 'deploy/skaffold/Dockerfile.skaffold'
- '.'

# Do the go build & push the results to GCS
- name: 'gcr.io/$PROJECT_ID/skaffold-builder:latest'
args:
- 'make'
- 'release-lts'
- 'VERSION=$TAG_NAME'
- 'RELEASE_BUCKET=$_RELEASE_BUCKET'
- 'GCP_PROJECT=$PROJECT_ID'
- 'make'
- 'release-lts'
- 'VERSION=$TAG_NAME'
- 'RELEASE_BUCKET=$_RELEASE_BUCKET'
- 'GCP_PROJECT=$PROJECT_ID'

# Check that skaffold is in the image
# Check that skaffold is in the image
- name: 'gcr.io/$PROJECT_ID/skaffold:$TAG_NAME-lts'
args:
- 'skaffold'
- 'version'
- 'skaffold'
- 'version'

images:
- 'gcr.io/$PROJECT_ID/skaffold:$TAG_NAME-lts'
- 'gcr.io/$PROJECT_ID/skaffold:$TAG_NAME-lts'
- 'us-east1-docker.pkg.dev/$PROJECT_ID/scanning/skaffold:$TAG_NAME-lts'

options:
machineType: 'N1_HIGHCPU_8'

timeout: 1500s
timeout: 1500s
1 change: 0 additions & 1 deletion deploy/cloudbuild-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ steps:
- 'version'

images:
- 'gcr.io/$PROJECT_ID/skaffold:latest'
- 'gcr.io/$PROJECT_ID/skaffold:$TAG_NAME'

options:
Expand Down
2 changes: 1 addition & 1 deletion deploy/skaffold/Dockerfile.deps
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,5 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge
jq \
apt-transport-https && \
rm -rf /var/lib/apt/lists/*
COPY --from=golang:1.19.2 /usr/local/go /usr/local/go
COPY --from=golang:1.19.6 /usr/local/go /usr/local/go
ENV PATH /usr/local/go/bin:/root/go/bin:$PATH
2 changes: 1 addition & 1 deletion deploy/skaffold/Dockerfile.deps.lts
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge
jq \
apt-transport-https && \
rm -rf /var/lib/apt/lists/*
COPY --from=golang:1.19.2 /usr/local/go /usr/local/go
COPY --from=golang:1.19.6 /usr/local/go /usr/local/go
ENV PATH /usr/local/go/bin:/root/go/bin:$PATH
2 changes: 1 addition & 1 deletion deploy/skaffold/Dockerfile.deps.slim
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge
jq \
apt-transport-https && \
rm -rf /var/lib/apt/lists/*
COPY --from=golang:1.19.2 /usr/local/go /usr/local/go
COPY --from=golang:1.19.6 /usr/local/go /usr/local/go
ENV PATH /usr/local/go/bin:/root/go/bin:$PATH
5 changes: 5 additions & 0 deletions deploy/skaffold/Dockerfile.skaffold
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ARG PROJECT_ID
FROM gcr.io/$PROJECT_ID/skaffold-builder:latest as builder

FROM gcr.io/distroless/static-debian11
COPY --from=builder /usr/bin/skaffold /usr/bin/skaffold
8 changes: 0 additions & 8 deletions examples/bazel/.bazelrc

This file was deleted.

14 changes: 5 additions & 9 deletions examples/bazel/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_docker",
sha256 = "4521794f0fba2e20f3bf15846ab5e01d5332e587e9ce81629c7f96c793bb7036",
strip_prefix = "rules_docker-0.14.4",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.14.4/rules_docker-v0.14.4.tar.gz"],
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
)

http_archive(
Expand All @@ -18,9 +17,10 @@ http_archive(
],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains(
go_version = "1.14.4",
)
Expand All @@ -39,13 +39,9 @@ load(

container_deps()

load("@io_bazel_rules_docker//repositories:pip_repositories.bzl", "pip_deps")

pip_deps()

load(
"@io_bazel_rules_docker//go:image.bzl",
_go_image_repos = "repositories",
)

_go_image_repos()
_go_image_repos()
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/v3
apiVersion: skaffold/v4beta1
kind: Config
build:
artifacts:
Expand Down
4 changes: 2 additions & 2 deletions examples/remote-multi-config-microservices/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ kind: Config
requires:
- git:
repo: https://github.com/GoogleContainerTools/skaffold
ref: main
ref: release/v2.0.7
path: examples/multi-config-microservices/leeroy-app
sync: false
- git:
repo: https://github.com/GoogleContainerTools/skaffold
ref: main
ref: release/v2.0.7
path: examples/multi-config-microservices/leeroy-web
sync: false
Loading

0 comments on commit eba7c3b

Please sign in to comment.