Repository: skupperproject/skupper
Pull request #1520 (2024-06-25 13:20:24)

Moved libpod generated client code to an external repo
This is just a draft PR that simply removed the need to generate libpod client code
and use it from a separate repository. 

At the moment, the PR is using a temporary repository but the idea is to transfer that
repository into the skupperproject org, once we are good with this change (and with
the repository name).

I am leaning towards, keeping it as: `skupperproject/skupper-libpod`.
Feel free to share your thoughts or concerns.

The repository will also be tagged with the appropriave OpenAPI spec version we are
using to generate clients and models. The dependency on that repo will also be based
on the respective tag, i.e: 4.0.3.

fgiorgetti: > +1 for skupperproject/skupper-libpod. IMO I'd take de-cluttering the package path a step further and generate packages at the root level (i.e. `github.com/skupperproject/skupper-libpod/client` instead of including the redundant pkg/libpod)

I was also considering `/client` initially, but looking at some openapi client examples, I wasn't sure if `/client` and `/models`
in the repository root, would be a good idea. But considering that code is not something we are offering for others to
consume, I am fine moving generated code to the root folder.

Any objection?


Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 0c27e108..4964f845 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -458,7 +458,7 @@ jobs:
                 exit 1
               fi
       - go/mod-download-cached
-      - run: make generate-client
+      - run: make
       - run:
           name: Creating artifacts directory
           command: mkdir /tmp/artifacts
@@ -506,7 +506,7 @@ jobs:
     steps:
       - checkout
       - go/mod-download-cached
-      - run: make generate-client
+      - run: make
 
       - compile_go_program:
           goos: linux
diff --git a/Makefile b/Makefile
index 90de626b..361026f2 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ PLATFORMS ?= linux/amd64,linux/arm64
 GOOS ?= linux
 GOARCH ?= amd64
 
-all: generate-client build-cmd build-get build-config-sync build-controllers build-tests build-manifest
+all: build-cmd build-get build-config-sync build-controllers build-tests build-manifest
 
 build-tests:
 	mkdir -p ${TEST_BINARIES_FOLDER}
@@ -24,7 +24,7 @@ build-tests:
 	GOOS=${GOOS} GOARCH=${GOARCH} go test -c -tags=job -v ./test/integration/examples/custom/hipstershop/job -o ${TEST_BINARIES_FOLDER}/grpcclient_test
 	GOOS=${GOOS} GOARCH=${GOARCH} go test -c -tags=job -v ./test/integration/examples/tls_t/job -o ${TEST_BINARIES_FOLDER}/tls_test
 
-build-cmd: generate-client
+build-cmd:
 	GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags="${LDFLAGS}"  -o skupper ./cmd/skupper
 
 build-get:
@@ -61,7 +61,7 @@ docker-build-test-image:
 	${DOCKER} buildx build --platform ${PLATFORMS} -t ${TEST_IMAGE} -f Dockerfile.ci-test .
 	${DOCKER} buildx build --load -t ${TEST_IMAGE} -f Dockerfile.ci-test .
 
-docker-build: generate-client docker-build-test-image
+docker-build: docker-build-test-image
 	${DOCKER} buildx build --platform ${PLATFORMS} -t ${SERVICE_CONTROLLER_IMAGE} -f Dockerfile.service-controller .
 	${DOCKER} buildx build --load  -t ${SERVICE_CONTROLLER_IMAGE} -f Dockerfile.service-controller .
 	${DOCKER} buildx build --platform ${PLATFORMS} -t ${CONTROLLER_PODMAN_IMAGE} -f Dockerfile.controller-podman .
@@ -88,11 +88,9 @@ format:
 
 generate-client:
 	./scripts/update-codegen.sh
-	./scripts/libpod-generate.sh
 
 force-generate-client:
 	FORCE=true ./scripts/update-codegen.sh
-	FORCE=true ./scripts/libpod-generate.sh
 
 client-mock-test:
 	go test -v -count=1 ./client
diff --git a/client/compat/container.go b/client/compat/container.go
index 549c7b0c..b92b7e89 100644
--- a/client/compat/container.go
+++ b/client/compat/container.go
@@ -13,9 +13,9 @@ import (
 	"github.com/go-openapi/runtime"
 	runtimeclient "github.com/go-openapi/runtime/client"
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/containers_compat"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/exec_compat"
-	"github.com/skupperproject/skupper/client/generated/libpod/models"
+	"github.com/skupperproject/skupper-libpod/v4/client/containers_compat"
+	"github.com/skupperproject/skupper-libpod/v4/client/exec_compat"
+	"github.com/skupperproject/skupper-libpod/v4/models"
 	"github.com/skupperproject/skupper/pkg/container"
 )
 
diff --git a/client/compat/container_mock.go b/client/compat/container_mock.go
index c5e370dc..f357e0a7 100644
--- a/client/compat/container_mock.go
+++ b/client/compat/container_mock.go
@@ -13,11 +13,11 @@ import (
 	"github.com/go-openapi/strfmt"
 	"github.com/google/uuid"
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/containers_compat"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/networks_compat"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/system_compat"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/volumes_compat"
-	"github.com/skupperproject/skupper/client/generated/libpod/models"
+	"github.com/skupperproject/skupper-libpod/v4/client/containers_compat"
+	"github.com/skupperproject/skupper-libpod/v4/client/networks_compat"
+	"github.com/skupperproject/skupper-libpod/v4/client/system_compat"
+	"github.com/skupperproject/skupper-libpod/v4/client/volumes_compat"
+	"github.com/skupperproject/skupper-libpod/v4/models"
 	"github.com/skupperproject/skupper/pkg/config"
 	"github.com/skupperproject/skupper/pkg/container"
 )
diff --git a/client/compat/image.go b/client/compat/image.go
index b9e55f77..bcd5f35f 100644
--- a/client/compat/image.go
+++ b/client/compat/image.go
@@ -11,7 +11,7 @@ import (
 	"time"
 
 	"github.com/go-openapi/runtime"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/images_compat"
+	"github.com/skupperproject/skupper-libpod/v4/client/images_compat"
 	"github.com/skupperproject/skupper/pkg/container"
 )
 
diff --git a/client/compat/network.go b/client/compat/network.go
index 928d6dea..409aae00 100644
--- a/client/compat/network.go
+++ b/client/compat/network.go
@@ -7,8 +7,8 @@ import (
 	"github.com/go-openapi/runtime"
 	"github.com/go-openapi/strfmt"
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/networks_compat"
-	"github.com/skupperproject/skupper/client/generated/libpod/models"
+	"github.com/skupperproject/skupper-libpod/v4/client/networks_compat"
+	"github.com/skupperproject/skupper-libpod/v4/models"
 	"github.com/skupperproject/skupper/pkg/container"
 	"github.com/skupperproject/skupper/pkg/utils"
 )
diff --git a/client/compat/parser.go b/client/compat/parser.go
index f41fde96..e0a399c9 100644
--- a/client/compat/parser.go
+++ b/client/compat/parser.go
@@ -7,7 +7,7 @@ import (
 	"regexp"
 
 	"github.com/go-openapi/runtime"
-	"github.com/skupperproject/skupper/client/generated/libpod/models"
+	"github.com/skupperproject/skupper-libpod/v4/models"
 )
 
 // boolTrue returns a true bool pointer (for false, just use new(bool))
diff --git a/client/compat/version.go b/client/compat/version.go
index b13fd4e6..d6839c53 100644
--- a/client/compat/version.go
+++ b/client/compat/version.go
@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"strings"
 
-	system "github.com/skupperproject/skupper/client/generated/libpod/client/system_compat"
+	system "github.com/skupperproject/skupper-libpod/v4/client/system_compat"
 	"github.com/skupperproject/skupper/pkg/container"
 	"github.com/skupperproject/skupper/pkg/utils"
 )
diff --git a/client/compat/volume.go b/client/compat/volume.go
index 044e2f0c..8549d2cf 100644
--- a/client/compat/volume.go
+++ b/client/compat/volume.go
@@ -7,8 +7,8 @@ import (
 	"github.com/go-openapi/runtime"
 	"github.com/go-openapi/strfmt"
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/volumes_compat"
-	"github.com/skupperproject/skupper/client/generated/libpod/models"
+	"github.com/skupperproject/skupper-libpod/v4/client/volumes_compat"
+	"github.com/skupperproject/skupper-libpod/v4/models"
 	"github.com/skupperproject/skupper/pkg/container"
 )
 
diff --git a/client/podman/container.go b/client/podman/container.go
index 5929a375..441b711b 100644
--- a/client/podman/container.go
+++ b/client/podman/container.go
@@ -11,9 +11,9 @@ import (
 	"github.com/go-openapi/runtime"
 	runtimeclient "github.com/go-openapi/runtime/client"
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/containers"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/exec"
-	"github.com/skupperproject/skupper/client/generated/libpod/models"
+	"github.com/skupperproject/skupper-libpod/v4/client/containers"
+	"github.com/skupperproject/skupper-libpod/v4/client/exec"
+	"github.com/skupperproject/skupper-libpod/v4/models"
 	"github.com/skupperproject/skupper/pkg/container"
 )
 
diff --git a/client/podman/container_mock.go b/client/podman/container_mock.go
index 93bc2074..f62ac742 100644
--- a/client/podman/container_mock.go
+++ b/client/podman/container_mock.go
@@ -11,11 +11,11 @@ import (
 	"github.com/go-openapi/runtime"
 	"github.com/go-openapi/strfmt"
 	"github.com/google/uuid"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/containers"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/networks"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/system"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/volumes"
-	"github.com/skupperproject/skupper/client/generated/libpod/models"
+	"github.com/skupperproject/skupper-libpod/v4/client/containers"
+	"github.com/skupperproject/skupper-libpod/v4/client/networks"
+	"github.com/skupperproject/skupper-libpod/v4/client/system"
+	"github.com/skupperproject/skupper-libpod/v4/client/volumes"
+	"github.com/skupperproject/skupper-libpod/v4/models"
 	"github.com/skupperproject/skupper/pkg/container"
 )
 
diff --git a/client/podman/image.go b/client/podman/image.go
index 23ce2f43..9238147d 100644
--- a/client/podman/image.go
+++ b/client/podman/image.go
@@ -9,7 +9,7 @@ import (
 	"strings"
 
 	"github.com/go-openapi/runtime"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/images"
+	"github.com/skupperproject/skupper-libpod/v4/client/images"
 	"github.com/skupperproject/skupper/pkg/container"
 )
 
diff --git a/client/podman/network.go b/client/podman/network.go
index 025d2146..1b5eada0 100644
--- a/client/podman/network.go
+++ b/client/podman/network.go
@@ -6,8 +6,8 @@ import (
 
 	"github.com/go-openapi/strfmt"
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/networks"
-	"github.com/skupperproject/skupper/client/generated/libpod/models"
+	"github.com/skupperproject/skupper-libpod/v4/client/networks"
+	"github.com/skupperproject/skupper-libpod/v4/models"
 	"github.com/skupperproject/skupper/pkg/container"
 	"github.com/skupperproject/skupper/pkg/utils"
 )
diff --git a/client/podman/rest.go b/client/podman/rest.go
index c373b2ed..e25634c7 100644
--- a/client/podman/rest.go
+++ b/client/podman/rest.go
@@ -17,7 +17,7 @@ import (
 	"github.com/go-openapi/runtime"
 	runtimeclient "github.com/go-openapi/runtime/client"
 	"github.com/go-openapi/strfmt"
-	"github.com/skupperproject/skupper/client/generated/libpod/models"
+	"github.com/skupperproject/skupper-libpod/v4/models"
 	"github.com/skupperproject/skupper/pkg/config"
 	"github.com/skupperproject/skupper/pkg/utils"
 )
diff --git a/client/podman/version.go b/client/podman/version.go
index a9446618..92944550 100644
--- a/client/podman/version.go
+++ b/client/podman/version.go
@@ -1,7 +1,7 @@
 package podman
 
 import (
-	"github.com/skupperproject/skupper/client/generated/libpod/client/system"
+	"github.com/skupperproject/skupper-libpod/v4/client/system"
 	"github.com/skupperproject/skupper/pkg/container"
 )
 
diff --git a/client/podman/volume.go b/client/podman/volume.go
index 154a8c32..f64ef3bb 100644
--- a/client/podman/volume.go
+++ b/client/podman/volume.go
@@ -4,8 +4,8 @@ import (
 	"fmt"
 
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/volumes"
-	"github.com/skupperproject/skupper/client/generated/libpod/models"
+	"github.com/skupperproject/skupper-libpod/v4/client/volumes"
+	"github.com/skupperproject/skupper-libpod/v4/models"
 	"github.com/skupperproject/skupper/pkg/container"
 )
 
diff --git a/go.mod b/go.mod
index 37833c7b..a7eb4381 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 module github.com/skupperproject/skupper
 
-go 1.21
+go 1.21.0
 
 require (
 	github.com/briandowns/spinner v1.23.0
@@ -22,6 +22,7 @@ require (
 	github.com/prometheus/client_golang v1.14.0
 	github.com/rogpeppe/go-internal v1.3.0
 	github.com/skupperproject/skupper-example-tcp-echo v0.0.0-20210727195922-db4a7dc7b35d
+	github.com/skupperproject/skupper-libpod/v4 v4.0.3-0
 	github.com/spf13/cobra v1.8.0
 	github.com/spf13/pflag v1.0.5
 	github.com/tsenart/vegeta/v12 v12.8.3
diff --git a/go.sum b/go.sum
index 094b4080..d43e179a 100644
--- a/go.sum
+++ b/go.sum
@@ -443,6 +443,8 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
 github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
 github.com/skupperproject/skupper-example-tcp-echo v0.0.0-20210727195922-db4a7dc7b35d h1:XmA9DC9Ffu1gnNAJZyjjoNImRs+iI5XBf/30YbqXVcs=
 github.com/skupperproject/skupper-example-tcp-echo v0.0.0-20210727195922-db4a7dc7b35d/go.mod h1:+Hm/U62PKiUAFpD3RTrjogZnPA0W2ZIDRG9+Cf7qjSU=
+github.com/skupperproject/skupper-libpod/v4 v4.0.3-0 h1:hhnfTCM0Re3bnQbdeC+ff3rJI4KTbqfr0H16HrGTcac=
+github.com/skupperproject/skupper-libpod/v4 v4.0.3-0/go.mod h1:ToBI6fKBtixpugNsnHZ3GqVh6mXiETXXwSJVOWqUvNk=
 github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
 github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
 github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
diff --git a/pkg/domain/podman/credential_handler.go b/pkg/domain/podman/credential_handler.go
index 5cc46e17..b3d5e6b8 100644
--- a/pkg/domain/podman/credential_handler.go
+++ b/pkg/domain/podman/credential_handler.go
@@ -7,7 +7,7 @@ import (
 	"path"
 
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/volumes"
+	"github.com/skupperproject/skupper-libpod/v4/client/volumes"
 	"github.com/skupperproject/skupper/client/podman"
 	"github.com/skupperproject/skupper/pkg/certs"
 	"github.com/skupperproject/skupper/pkg/container"
diff --git a/pkg/domain/podman/router_config_handler.go b/pkg/domain/podman/router_config_handler.go
index 960dcadb..0b827b64 100644
--- a/pkg/domain/podman/router_config_handler.go
+++ b/pkg/domain/podman/router_config_handler.go
@@ -6,7 +6,7 @@ import (
 	"path"
 
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/volumes"
+	"github.com/skupperproject/skupper-libpod/v4/client/volumes"
 	"github.com/skupperproject/skupper/client/podman"
 	"github.com/skupperproject/skupper/pkg/container"
 	"github.com/skupperproject/skupper/pkg/qdr"


Test patch:
diff --git a/client/compat/client_test.go b/client/compat/client_test.go
index ef32b1f4..5e4a06c9 100644
--- a/client/compat/client_test.go
+++ b/client/compat/client_test.go
@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"testing"
 
-	"github.com/skupperproject/skupper/client/generated/libpod/client/volumes_compat"
+	"github.com/skupperproject/skupper-libpod/v4/client/volumes_compat"
 	"gotest.tools/assert"
 )
 
diff --git a/client/compat/container_test.go b/client/compat/container_test.go
index 4c36824b..6631ab13 100644
--- a/client/compat/container_test.go
+++ b/client/compat/container_test.go
@@ -14,7 +14,7 @@ import (
 
 	"github.com/go-openapi/runtime"
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/containers_compat"
+	"github.com/skupperproject/skupper-libpod/v4/client/containers_compat"
 	"github.com/skupperproject/skupper/pkg/container"
 	"github.com/skupperproject/skupper/pkg/images"
 	"github.com/skupperproject/skupper/pkg/utils"
diff --git a/client/podman/container_test.go b/client/podman/container_test.go
index 10131481..1b89d1ef 100644
--- a/client/podman/container_test.go
+++ b/client/podman/container_test.go
@@ -14,7 +14,7 @@ import (
 
 	"github.com/go-openapi/runtime"
 	"github.com/skupperproject/skupper/api/types"
-	"github.com/skupperproject/skupper/client/generated/libpod/client/containers"
+	"github.com/skupperproject/skupper-libpod/v4/client/containers"
 	"github.com/skupperproject/skupper/pkg/container"
 	"github.com/skupperproject/skupper/pkg/images"
 	"github.com/skupperproject/skupper/pkg/utils"