Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a5704fd
feat: add integration test for kubernetes first attempt
OliverTrautvetter Feb 18, 2026
f0f232e
Merge remote-tracking branch 'origin/main' into kubernetes_integratio…
OliverTrautvetter Mar 2, 2026
955167b
fix: merge error
OliverTrautvetter Mar 2, 2026
3f57bdc
chore(docs): Auto-update docs and licenses
OliverTrautvetter Mar 2, 2026
09c2f23
ref: streamline file path handling in Docker and Kubernetes commands
OliverTrautvetter Mar 2, 2026
fcd75da
Merge branch 'kubernetes_integration_tests' of https://github.com/cod…
OliverTrautvetter Mar 2, 2026
483d1c4
test: add integration tests for invalid and empty ci.yml scenarios
OliverTrautvetter Mar 2, 2026
f54ac3f
fix: integration tests
OliverTrautvetter Mar 2, 2026
49c6050
Merge branch 'main' into kubernetes_integration_tests
OliverTrautvetter Mar 5, 2026
d75a949
chore(docs): Auto-update docs and licenses
OliverTrautvetter Mar 5, 2026
29beba5
Merge branch 'main' into kubernetes_integration_tests
OliverTrautvetter Mar 9, 2026
d999bb1
Merge branch 'main' into kubernetes_integration_tests
OliverTrautvetter Mar 9, 2026
f287fd7
feat: enhance Kubernetes integration tests with validation functions …
OliverTrautvetter Mar 9, 2026
2c9d059
feat: add local integration test target and update test filtering for…
OliverTrautvetter Mar 10, 2026
32559e1
ref: move Local Integration Tests to integration-test.yml and remove …
OliverTrautvetter Mar 10, 2026
51fafa7
fix: ensure Local Integration Tests run even if previous tests fail
OliverTrautvetter Mar 10, 2026
c48438c
Merge branch 'main' into kubernetes_integration_tests
OliverTrautvetter Mar 10, 2026
2b4aa6b
chore(docs): Auto-update docs and licenses
OliverTrautvetter Mar 10, 2026
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
4 changes: 4 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
CS_TEAM_ID: ${{ secrets.CS_TEAM_ID }}
run: make test-int

- name: Local Integration Tests
if: always() # Run even if make test-int fails
run: make test-int-local

- name: Cleanup Orphaned Test Resources
if: always() # Run even if tests fail
env:
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ test:
go test ./api/... ./cli/... ./pkg/... -count=1

test-int: build
go test ./int/... -count=1 -v
go test ./int/... -count=1 -v -ginkgo.label-filter='!local'

test-int-local: build
go test ./int/... -count=1 -v -ginkgo.label-filter='local'

generate: install-build-deps
go generate ./...
Expand Down
4 changes: 2 additions & 2 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ License URL: https://cs.opensource.google/go/x/oauth2/+/v0.35.0:LICENSE

----------
Module: golang.org/x/sync/errgroup
Version: v0.19.0
Version: v0.20.0
License: BSD-3-Clause
License URL: https://cs.opensource.google/go/x/sync/+/v0.19.0:LICENSE
License URL: https://cs.opensource.google/go/x/sync/+/v0.20.0:LICENSE

----------
Module: golang.org/x/sys
Expand Down
172 changes: 91 additions & 81 deletions api/openapi_client/client.go

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

27 changes: 15 additions & 12 deletions cli/cmd/generate_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"log"
"path"

"github.com/codesphere-cloud/cs-go/pkg/cs"
"github.com/codesphere-cloud/cs-go/pkg/exporter"
Expand All @@ -28,17 +27,16 @@ type GenerateDockerOpts struct {
}

func (c *GenerateDockerCmd) RunE(cc *cobra.Command, args []string) error {
log.Println(c.Opts.Force)
fs := cs.NewOSFileSystem(".")
git := git.NewGitService(fs)
fs := cs.NewOSFileSystem(c.Opts.RepoRoot)
gitSvc := git.NewGitService(fs)

client, err := NewClient(*c.Opts.GlobalOptions)
if err != nil {
return fmt.Errorf("failed to create Codesphere client: %w", err)
exporter := exporter.NewExporterService(fs, c.Opts.Output, c.Opts.BaseImage, c.Opts.Envs, c.Opts.RepoRoot, c.Opts.Force)

clientFactory := func() (Client, error) {
return NewClient(*c.Opts.GlobalOptions)
}

exporter := exporter.NewExporterService(fs, c.Opts.Output, c.Opts.BaseImage, c.Opts.Envs, c.Opts.RepoRoot, c.Opts.Force)
if err := c.GenerateDocker(fs, exporter, git, client); err != nil {
if err := c.GenerateDocker(fs, exporter, gitSvc, clientFactory); err != nil {
return fmt.Errorf("failed to generate docker: %w", err)
}

Expand Down Expand Up @@ -95,16 +93,21 @@ func AddGenerateDockerCmd(generate *cobra.Command, opts *GenerateOpts) {
docker.cmd.RunE = docker.RunE
}

func (c *GenerateDockerCmd) GenerateDocker(fs *cs.FileSystem, exp exporter.Exporter, git git.Git, csClient Client) error {
func (c *GenerateDockerCmd) GenerateDocker(fs *cs.FileSystem, exp exporter.Exporter, git git.Git, clientFactory func() (Client, error)) error {
if c.Opts.BaseImage == "" {
return errors.New("baseimage is required")
}

ciInput := path.Join(c.Opts.RepoRoot, c.Opts.Input)
ciInput := c.Opts.Input
if !fs.FileExists(ciInput) {
log.Printf("Input file %s not found attempting to clone workspace repository...\n", c.Opts.Input)

if err := c.CloneRepository(csClient, fs, git, c.Opts.RepoRoot); err != nil {
client, err := clientFactory()
if err != nil {
return fmt.Errorf("failed to create Codesphere client: %w", err)
}

if err := c.CloneRepository(client, fs, git, c.Opts.RepoRoot); err != nil {
return fmt.Errorf("failed to clone repository: %w", err)
}
if !fs.FileExists(ciInput) {
Expand Down
6 changes: 4 additions & 2 deletions cli/cmd/generate_docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ var _ = Describe("GenerateDocker", func() {

Context("the baseimage is not provided", func() {
It("should return an error", func() {
err := c.GenerateDocker(memoryFs, mockExporter, mockGit, mockClient)
clientFactory := func() (cmd.Client, error) { return mockClient, nil }
err := c.GenerateDocker(memoryFs, mockExporter, mockGit, clientFactory)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("baseimage is required"))
})
Expand All @@ -79,7 +80,8 @@ var _ = Describe("GenerateDocker", func() {
It("should not return an error", func() {
mockExporter.EXPECT().ReadYmlFile(ciYmlPath).Return(&ci.CiYml{}, nil)
mockExporter.EXPECT().ExportDockerArtifacts().Return(nil)
err := c.GenerateDocker(memoryFs, mockExporter, mockGit, mockClient)
clientFactory := func() (cmd.Client, error) { return mockClient, nil }
err := c.GenerateDocker(memoryFs, mockExporter, mockGit, clientFactory)
Expect(err).To(Not(HaveOccurred()))
})
})
Expand Down
5 changes: 2 additions & 3 deletions cli/cmd/generate_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"log"
"path"

"github.com/codesphere-cloud/cs-go/pkg/cs"
"github.com/codesphere-cloud/cs-go/pkg/exporter"
Expand All @@ -28,7 +27,7 @@ type GenerateImagesOpts struct {
}

func (c *GenerateImagesCmd) RunE(_ *cobra.Command, args []string) error {
fs := cs.NewOSFileSystem(".")
fs := cs.NewOSFileSystem(c.Opts.RepoRoot)

exporter := exporter.NewExporterService(fs, c.Opts.Output, "", []string{}, c.Opts.RepoRoot, c.Opts.Force)
if err := c.GenerateImages(fs, exporter); err != nil {
Expand Down Expand Up @@ -69,7 +68,7 @@ func AddGenerateImagesCmd(generate *cobra.Command, opts *GenerateOpts) {
}

func (c *GenerateImagesCmd) GenerateImages(fs *cs.FileSystem, exp exporter.Exporter) error {
ciInput := path.Join(c.Opts.RepoRoot, c.Opts.Input)
ciInput := c.Opts.Input
if c.Opts.Registry == "" {
return errors.New("registry is required")
}
Expand Down
Loading
Loading