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

drop go1.20 and start testing with go1.22 and ci updates #1251

Merged
merged 8 commits into from Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Expand Up @@ -12,8 +12,8 @@ jobs:
fail-fast: false
matrix:
go-version:
- '1.20'
- '1.21'
- '1.22'

name: Build ${{ matrix.go-version }}
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/modules-integration-test.yaml
Expand Up @@ -11,8 +11,8 @@ jobs:
strategy:
matrix:
go-version:
- '1.20'
- '1.21'
- '1.22'

runs-on: 'ubuntu-latest'
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Expand Up @@ -30,7 +30,7 @@ jobs:
# This installs the current latest release.
- uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6
with:
version: v0.14.1
version: v0.15.2

- uses: imjasonh/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # v0.3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify.yaml
Expand Up @@ -32,5 +32,5 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
with:
version: v1.54
version: v1.56
args: --timeout=5m
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -5,7 +5,7 @@ go 1.21
require (
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240323062759-1fd604ae58de
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589
github.com/docker/docker v25.0.3+incompatible
github.com/docker/docker v25.0.5+incompatible
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936
github.com/go-training/helloworld v0.0.0-20200225145412-ba5f4379d78b
github.com/google/go-cmp v0.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -100,8 +100,8 @@ github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1x
github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v25.0.3+incompatible h1:D5fy/lYmY7bvZa0XTZ5/UJPljor41F+vdyJG5luQLfQ=
github.com/docker/docker v25.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE=
github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo=
github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
Expand Down
50 changes: 18 additions & 32 deletions integration_test.sh
Expand Up @@ -20,14 +20,8 @@ echo "Copying ko to temp gopath."
mkdir -p "$GOPATH/src/github.com/google/ko"
cp -r "$ROOT_DIR/"* "$GOPATH/src/github.com/google/ko/"

echo "Downloading github.com/go-training/helloworld"
GO111MODULE=off go get -d github.com/go-training/helloworld

pushd "$GOPATH/src/github.com/google/ko" || exit 1

echo "Replacing hello world in vendor with TEST."
sed -i 's/Hello World/TEST/g' ./vendor/github.com/go-training/helloworld/main.go

echo "Building ko"

RESULT="$(GO111MODULE="on" GOFLAGS="-mod=vendor" go build .)"
Expand All @@ -36,65 +30,57 @@ echo "Beginning scenarios."

FILTER="[^ ]local[^ ]*"

echo "1. GOPATH mode should always create an image that outputs 'Hello World'"
RESULT="$(GO111MODULE=off ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"Hello World"** ]]; then
echo "Test FAILED. Saw $RESULT" && exit 1
else
echo "Test PASSED"
fi

echo "2. Go module auto mode should create an image that outputs 'Hello World' when run outside the module."
echo "1. Go module auto mode should create an image that outputs 'Hello World' when run outside the module."

pushd .. || exit 1
RESULT="$(GO111MODULE=auto GOFLAGS="-mod=vendor" ./ko/ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"Hello World"* ]]; then
RESULT="$(GO111MODULE=auto GOFLAGS="-mod=vendor" ./ko/ko build --local "$GOPATH/src/github.com/google/ko/test" | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"Hello there"* ]]; then
echo "Test FAILED. Saw $RESULT" && exit 1
else
echo "Test PASSED"
fi

popd || exit 1

echo "3. Auto inside the module with vendoring should output TEST"
echo "2. Auto inside the module with vendoring should output Hello there"

RESULT="$(GO111MODULE=auto GOFLAGS="-mod=vendor" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"TEST"* ]]; then
RESULT="$(GO111MODULE=auto GOFLAGS="-mod=vendor" ./ko build --local "$GOPATH/src/github.com/google/ko/test" | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"Hello there"* ]]; then
echo "Test FAILED. Saw $RESULT" && exit 1
else
echo "Test PASSED"
fi

echo "4. Auto inside the module without vendoring should output TEST"
RESULT="$(GO111MODULE=auto GOFLAGS="" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"TEST"* ]]; then
echo "3. Auto inside the module without vendoring should output Hello there"
RESULT="$(GO111MODULE=auto GOFLAGS="" ./ko build --local "$GOPATH/src/github.com/google/ko/test" | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"Hello there"* ]]; then
echo "Test FAILED. Saw $RESULT" && exit 1
else
echo "Test PASSED"
fi

echo "5. On inside the module with vendor should output TEST."
RESULT="$(GO111MODULE=on GOFLAGS="-mod=vendor" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"TEST"* ]]; then
echo "4. On inside the module with vendor should output Hello there."
RESULT="$(GO111MODULE=on GOFLAGS="-mod=vendor" ./ko build --local "$GOPATH/src/github.com/google/ko/test" | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"Hello there"* ]]; then
echo "Test FAILED. Saw $RESULT" && exit 1
else
echo "Test PASSED"
fi

echo "6. On inside the module without vendor should output TEST"
RESULT="$(GO111MODULE=on GOFLAGS="" ./ko build --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"TEST"* ]]; then
echo "5. On inside the module without vendor should output Hello there"
RESULT="$(GO111MODULE=on GOFLAGS="" ./ko build --local "$GOPATH/src/github.com/google/ko/test" | grep "$FILTER" | xargs -I% docker run %)"
if [[ "$RESULT" != *"Hello there"* ]]; then
echo "Test FAILED. Saw $RESULT" && exit 1
else
echo "Test PASSED"
fi

echo "7. On outside the module should fail."
echo "6. On outside the module should fail."
pushd .. || exit 1
GO111MODULE=on ./ko/ko build --local github.com/go-training/helloworld && exit 1
GO111MODULE=on ./ko/ko build --local "$GOPATH/src/github.com/google/ko/test" && exit 1
popd || exit 1

echo "8. On outside with build config specifying the test module builds."
echo "7. On outside with build config specifying the test module builds."
pushd test/build-configs || exit 1
for app in foo bar ; do
# test both local and fully qualified import paths
Expand Down
2 changes: 1 addition & 1 deletion pkg/build/recorder_test.go
Expand Up @@ -101,7 +101,7 @@ func TestBuildRecording(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
inner := &fake{
b: func(ip string) (Result, error) {
b: func(_ string) (Result, error) {
return nil, nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/resolve.go
Expand Up @@ -54,7 +54,7 @@ func addResolve(topLevel *cobra.Command) {
# This always preserves import paths.
ko resolve --local -f config/`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
if err := options.Validate(po, bo); err != nil {
return fmt.Errorf("validating options: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/root.go
Expand Up @@ -32,7 +32,7 @@ func New() *cobra.Command {
Short: "Rapidly iterate with Go, Containers, and Kubernetes.",
SilenceUsage: true, // Don't show usage on errors
DisableAutoGenTag: true,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
PersistentPreRun: func(_ *cobra.Command, _ []string) {
if verbose {
logs.Warn.SetOutput(os.Stderr)
logs.Debug.SetOutput(os.Stderr)
Expand All @@ -41,7 +41,7 @@ func New() *cobra.Command {

maxprocs.Set(maxprocs.Logger(logs.Debug.Printf))
},
Run: func(cmd *cobra.Command, args []string) {
Run: func(cmd *cobra.Command, _ []string) {
cmd.Help()
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/version.go
Expand Up @@ -29,7 +29,7 @@ func addVersion(topLevel *cobra.Command) {
topLevel.AddCommand(&cobra.Command{
Use: "version",
Short: `Print ko version.`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
v := version()
if v == "" {
fmt.Println("could not determine build information")
Expand Down
2 changes: 1 addition & 1 deletion pkg/publish/recorder.go
Expand Up @@ -55,7 +55,7 @@ func (r *recorder) Publish(ctx context.Context, br build.Result, ref string) (na
references := make([]string, 0, 20 /* just try to avoid resizing*/)
switch t := br.(type) {
case oci.SignedImageIndex:
if err := walk.SignedEntity(ctx, t, func(ctx context.Context, se oci.SignedEntity) error {
if err := walk.SignedEntity(ctx, t, func(_ context.Context, se oci.SignedEntity) error {
// Both of the SignedEntity types implement Digest()
h, err := se.(interface{ Digest() (v1.Hash, error) }).Digest()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/publish/recorder_test.go
Expand Up @@ -42,7 +42,7 @@ func (sp *cbPublish) Close() error {

func TestRecorder(t *testing.T) {
repo := name.MustParseReference("docker.io/ubuntu:latest")
inner := &cbPublish{cb: func(c context.Context, b build.Result, s string) (name.Reference, error) {
inner := &cbPublish{cb: func(_ context.Context, b build.Result, _ string) (name.Reference, error) {
h, err := b.Digest()
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions test/main.go
Expand Up @@ -31,7 +31,7 @@ import (

var (
f = flag.String("f", "kenobi", "File in kodata to print")
wait = flag.Bool("wait", true, "Whether to wait for SIGTERM")
wait = flag.Bool("wait", false, "Whether to wait for SIGTERM")
)

// This is defined so we can test build-time variable setting using ldflags.
Expand Down Expand Up @@ -66,7 +66,7 @@ func main() {
if err != nil {
log.Fatalf("Error reading %q: %v", file, err)
}
log.Print(string(bytes))
fmt.Println(string(bytes))

// Cause the pod to "hang" to allow us to check for a readiness state.
if *wait {
Expand Down
2 changes: 2 additions & 0 deletions test/test.yaml
Expand Up @@ -19,4 +19,6 @@ spec:
containers:
- name: obiwan
image: ko://github.com/google/ko/test
args:
- --wait=true
restartPolicy: Never
12 changes: 10 additions & 2 deletions vendor/github.com/docker/docker/api/swagger.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion vendor/github.com/docker/docker/api/types/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions vendor/github.com/docker/docker/client/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion vendor/github.com/docker/docker/client/container_create.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion vendor/github.com/docker/docker/client/container_exec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion vendor/github.com/docker/docker/client/container_restart.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion vendor/github.com/docker/docker/client/container_stop.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions vendor/github.com/docker/docker/client/container_wait.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.