Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/test-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
name: Test GH
runs-on: ubuntu-latest
environment: DockerHub E2E
env:
DOCKER_API_VERSION: "1.44"
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.0
Expand All @@ -40,6 +42,10 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
only: ytt, kapp
- name: Check Default Docker Version
run: |
echo "=== Docker version ==="
docker version || echo "docker-version not found"
- name: Run Tests
env:
DOCKERHUB_USERNAME: k8slt
Expand All @@ -48,6 +54,13 @@ jobs:
set -e -x

minikube start --driver=docker --wait=all --mount --mount-string "$HOME:$HOME"

# RELAX THE API REQUIREMENT
# This reaches inside the minikube node, updates the daemon config, and restarts Docker
minikube ssh "sudo mkdir -p /etc/docker && echo '{\"min-api-version\": \"1.38\"}' | sudo tee /etc/docker/daemon.json && sudo systemctl restart docker"
# Wait a few seconds for the internal docker to come back up
sleep 5

eval $(minikube docker-env --shell=bash)

# when this workflow runs of a pull request based on a fork, secrets are unavailable
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module carvel.dev/kbld

go 1.25.6
go 1.25.7

require (
carvel.dev/imgpkg v0.47.1
carvel.dev/vendir v0.45.1
carvel.dev/imgpkg v0.47.2
carvel.dev/vendir v0.45.2
github.com/cppforlife/cobrautil v0.0.0-20221021151949-d60711905d65
github.com/cppforlife/go-cli-ui v0.0.0-20220428182907-73db60c7611a
github.com/google/go-containerregistry v0.20.6
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
carvel.dev/imgpkg v0.47.1 h1:5hJu20JeAr3HGGRCDi2ydlKVEhhF6bq0EebdB9Eql2I=
carvel.dev/imgpkg v0.47.1/go.mod h1:f/LUtEuUHTdAeFfDcRa2MTwfXbQe6cq+kzzlQF0In6w=
carvel.dev/vendir v0.45.1 h1:vVZjAEZz/j1HVLfm1/avlRF235skXpHFrx77GDqJMgo=
carvel.dev/vendir v0.45.1/go.mod h1:t7/ulJsKBhyOAFyJUt3m1JyIdyvZsAh8eLGr0n1MiLk=
carvel.dev/imgpkg v0.47.2 h1:rEqC/Saf3PHmHEhaJMcqZLjatALTPD9VmBXuUYqPaGk=
carvel.dev/imgpkg v0.47.2/go.mod h1:3vIZkREPq+i7s8eloLEv5+t+LzzC49uv9xeh+KLADdk=
carvel.dev/vendir v0.45.2 h1:oaOqEVgw/z4AZgCvZPgfY+JUFf3YGJSUTH2QLTyIV5A=
carvel.dev/vendir v0.45.2/go.mod h1:R6wZyF61/mbTe4VpXBky0FiDNoCSIND+/LQvUJkkQVQ=
github.com/carvel-dev/semver/v4 v4.0.1-0.20240402203627-beb83fbf25e4 h1:F4rZiMGZyC66j9VB7doVOE4tFHF1yNEihQlOuht4jmM=
github.com/carvel-dev/semver/v4 v4.0.1-0.20240402203627-beb83fbf25e4/go.mod h1:4cFTBLAr/U11ykiEEQMccu4uJ1i0GS+atJmeETHCFtI=
github.com/containerd/stargz-snapshotter/estargz v0.16.3 h1:7evrXtoh1mSbGj/pfRccTampEyKpjpOnS3CyiV1Ebr8=
Expand Down
4 changes: 2 additions & 2 deletions hack/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.25.6
FROM golang:1.25.7

RUN apt-get update -y
RUN apt-get install docker.io apt-transport-https ca-certificates gnupg python-is-python3 -y
Expand All @@ -13,7 +13,7 @@ RUN curl -sL https://github.com/vmware-tanzu/buildkit-cli-for-kubectl/releases/d

RUN curl -sL https://github.com/google/ko/releases/download/v0.8.0/ko_0.8.0_Linux_x86_64.tar.gz | tar -C /usr/local/bin -xz

RUN curl -sLo /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/4.2.0/bazel-4.2.0-linux-x86_64
RUN curl -sLo /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/6.4.0/bazel-6.4.0-linux-x86_64
Comment thread
devacts marked this conversation as resolved.
RUN chmod +x /usr/local/bin/bazel

RUN curl -sLo /usr/local/bin/kapp https://github.com/carvel-dev/kapp/releases/download/v0.48.0/kapp-linux-amd64
Expand Down
1 change: 1 addition & 0 deletions hack/test-all-locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ done > $tempConfigFile
docker run \
--privileged \
--env-file $tempConfigFile \
-e DOCKER_API_VERSION=1.44 \
-e KBLD_E2E_SKIP_WHEN_HTTP_REGISTRY=${KBLD_E2E_SKIP_WHEN_HTTP_REGISTRY:-true} \
-e KBLD_E2E_DOCKERHUB_HOSTNAME=`minikube ip`:30777 \
-v ~/.config:/root/.config \
Expand Down
1 change: 1 addition & 0 deletions hack/test-all-minikube-local-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e -x -u

export KBLD_E2E_DOCKERHUB_USERNAME=minikube-tests
export KBLD_E2E_DOCKERHUB_HOSTNAME=${KBLD_E2E_DOCKERHUB_HOSTNAME:-`minikube ip`}
export DOCKER_API_VERSION=1.44
# uncomment to disable stress tests
# export KBLD_E2E_SKIP_STRESS_TESTS=true

Expand Down
4 changes: 2 additions & 2 deletions hack/test-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ if [ "$(ko version)" != "0.8.0" ]; then
exit 1
fi

if [ "$(bazel --version | grep -o '4.2.0')" != "4.2.0" ]; then
echo "Please install 'bazel' from https://github.com/bazelbuild/bazel/releases/tag/4.2.0"
if [ "$(bazel --version | grep -o '6.4.0')" != "6.4.0" ]; then
echo "Please install 'bazel' from https://github.com/bazelbuild/bazel/releases/tag/6.4.0"
exit 1
fi

Expand Down
32 changes: 29 additions & 3 deletions test/e2e/assets/simple-app/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
],
)

http_archive(
name = "bazel_gazelle",
sha256 = "5d80e62a70314f39cc764c1c3eaa800c5936c9f1ea91625006227ce4d20cd086",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.42.0/bazel-gazelle-v0.42.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.42.0/bazel-gazelle-v0.42.0.tar.gz",
],
)

http_archive(
name = "io_bazel_rules_docker",
sha256 = "1f4e59843b61981a96835dc4ac377ad4da9f8c334ebe5e0bb3f58f80c09735f4",
strip_prefix = "rules_docker-0.19.0",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.19.0/rules_docker-v0.19.0.tar.gz"],
sha256 = "f6dcb97e992f13bc9effd794e9bb300f06b0dadc88061f81ae68d8d5994be964",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.26.0/rules_docker-v0.26.0.tar.gz"],
)

# Initialize rules_go
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.23.1")

# Initialize Gazelle
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()

load(
"@io_bazel_rules_docker//repositories:repositories.bzl",
container_repositories = "repositories",
Expand Down
22 changes: 18 additions & 4 deletions test/e2e/build_bazel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package e2e

import (
"fmt"
"os/exec"
"regexp"
"strings"
"testing"
Expand All @@ -14,7 +16,19 @@ import (
func TestBazelBuildAndPushSuccessful(t *testing.T) {
env := BuildEnv(t)
kbld := Kbld{t, env.KbldBinaryPath, Logger{}}
input := env.WithRegistries(`

assetPath := "assets/simple-app"
secondAssetPath := "assets/simple-app-2"
if err := exec.Command("cp", "-r", assetPath, secondAssetPath).Run(); err != nil {
t.Fatalf("failed to copy %s to %s: %v", assetPath, secondAssetPath, err)
}
defer func() {
if err := exec.Command("rm", "-rf", secondAssetPath).Run(); err != nil {
t.Logf("failed to remove %s: %v", secondAssetPath, err)
}
}()

input := env.WithRegistries(fmt.Sprintf(`
kind: Object
spec:
- image: docker.io/*username*/kbld-e2e-tests-build
Expand All @@ -24,12 +38,12 @@ apiVersion: kbld.k14s.io/v1alpha1
kind: Sources
sources:
- image: docker.io/*username*/kbld-e2e-tests-build
path: assets/simple-app
path: %s
bazel:
run:
target: :simple-app
- image: docker.io/*username*/kbld-e2e-tests-build2
path: assets/simple-app
Comment thread
aroradaman marked this conversation as resolved.
path: %s
bazel:
run:
target: :simple-app
Expand All @@ -39,7 +53,7 @@ kind: ImageDestinations
destinations:
- image: docker.io/*username*/kbld-e2e-tests-build
- image: docker.io/*username*/kbld-e2e-tests-build2
`)
`, assetPath, secondAssetPath))

out, _ := kbld.RunWithOpts([]string{"-f", "-", "--images-annotation=false"}, RunOpts{
StdinReader: strings.NewReader(input),
Expand Down
23 changes: 19 additions & 4 deletions test/e2e/build_pack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package e2e

import (
"fmt"
"os/exec"
"regexp"
"strings"
"testing"
Expand All @@ -15,7 +17,20 @@ func TestPackBuildAndPushSuccessful(t *testing.T) {
env := BuildEnv(t)
kbld := Kbld{t, env.KbldBinaryPath, Logger{}}

input := env.WithRegistries(`
// Copy asset to avoid parallel build interference
assetPath := "assets/simple-app"
secondAssetPath := "assets/simple-app-2"
copyCmd := exec.Command("cp", "-r", assetPath, secondAssetPath)
if err := copyCmd.Run(); err != nil {
t.Fatalf("failed to copy asset from %s to %s: %v", assetPath, secondAssetPath, err)
}
defer func() {
if err := exec.Command("rm", "-rf", secondAssetPath).Run(); err != nil {
t.Logf("failed to remove temporary asset path %s: %v", secondAssetPath, err)
}
}()

input := env.WithRegistries(fmt.Sprintf(`
kind: Object
spec:
- image: docker.io/*username*/kbld-e2e-tests-build
Expand All @@ -25,12 +40,12 @@ apiVersion: kbld.k14s.io/v1alpha1
kind: Sources
sources:
- image: docker.io/*username*/kbld-e2e-tests-build
path: assets/simple-app
path: %s
pack: &pack
build:
builder: index.docker.io/cloudfoundry/cnb@sha256:83270cf59e8944be0c544e45fd45a5a1f4526d7936d488d2de8937730341618d
- image: docker.io/*username*/kbld-e2e-tests-build2
path: assets/simple-app
Comment thread
devacts marked this conversation as resolved.
path: %s
pack: &pack
build:
builder: index.docker.io/cloudfoundry/cnb@sha256:83270cf59e8944be0c544e45fd45a5a1f4526d7936d488d2de8937730341618d
Expand All @@ -40,7 +55,7 @@ kind: ImageDestinations
destinations:
- image: docker.io/*username*/kbld-e2e-tests-build
- image: docker.io/*username*/kbld-e2e-tests-build2
`)
`, assetPath, secondAssetPath))

out, _ := kbld.RunWithOpts([]string{"-f", "-", "--images-annotation=false"}, RunOpts{
StdinReader: strings.NewReader(input),
Expand Down
8 changes: 4 additions & 4 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# carvel.dev/imgpkg v0.47.1
## explicit; go 1.25.6
# carvel.dev/imgpkg v0.47.2
## explicit; go 1.25.7
carvel.dev/imgpkg/pkg/imgpkg/lockconfig
# carvel.dev/vendir v0.45.1
## explicit; go 1.25.6
# carvel.dev/vendir v0.45.2
## explicit; go 1.25.7
carvel.dev/vendir/pkg/vendir/versions
carvel.dev/vendir/pkg/vendir/versions/v1alpha1
# github.com/carvel-dev/semver/v4 v4.0.1-0.20240402203627-beb83fbf25e4
Expand Down
Loading