Skip to content
Open
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
5 changes: 3 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
v1.5.3
Push Docker images to one ECR region
v1.5.4
Temporarily disable Go version checks

Previously:
- Push Docker images to one ECR region
- add option to pass branch name and dryRun to catalog-sync
- add shared workflow for Claude actions
92 changes: 46 additions & 46 deletions cmd/goci/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@ package main

import (
"context"
"errors"
"fmt"
"io"
"net/http"
"os"
"regexp"
"strconv"
"strings"

"golang.org/x/mod/modfile"

"github.com/Clever/catapult/gen-go/models"
"github.com/Clever/ci-scripts/internal/backstage"
"github.com/Clever/ci-scripts/internal/catapult"
Expand Down Expand Up @@ -165,56 +161,60 @@ func validateRun() error {
return &ValidationError{Message: fmt.Sprintf("branch name %s contains a `/` character, which is not supported by catapult", environment.Branch())}
}

latestGoVersion, releaseDate, err := fetchLatestGoVersion()
if err != nil {
return fmt.Errorf("failed to fetch latest Go version: %v", err)
}
// TODO: Re-enable Go version check after golden images project is complete
// Go version check temporarily disabled for golden images project
/*
latestGoVersion, releaseDate, err := fetchLatestGoVersion()
if err != nil {
return fmt.Errorf("failed to fetch latest Go version: %v", err)
}

goModPath := "./go.mod"
fileBytes, err := os.ReadFile(goModPath)
// If the go.mod file is not found, we will skip the go version check
if errors.Is(err, os.ErrNotExist) {
return nil
} else if err != nil {
return fmt.Errorf("failed to read go.mod file: %v", err)
}
goModPath := "./go.mod"
fileBytes, err := os.ReadFile(goModPath)
// If the go.mod file is not found, we will skip the go version check
if errors.Is(err, os.ErrNotExist) {
return nil
} else if err != nil {
return fmt.Errorf("failed to read go.mod file: %v", err)
}

f, err := modfile.Parse("./go.mod", fileBytes, nil)
if err != nil {
return fmt.Errorf("failed to parse go.mod file: %v", err)
}
f, err := modfile.Parse("./go.mod", fileBytes, nil)
if err != nil {
return fmt.Errorf("failed to parse go.mod file: %v", err)
}

// trim the patch value from the authoring repositories go version - if 2 dots are present
var trimmedVersion string
if strings.Count(f.Go.Version, ".") == 2 {
trimmedVersion = f.Go.Version[:len(f.Go.Version)-2]
} else {
trimmedVersion = f.Go.Version
}
// trim the patch value from the authoring repositories go version - if 2 dots are present
var trimmedVersion string
if strings.Count(f.Go.Version, ".") == 2 {
trimmedVersion = f.Go.Version[:len(f.Go.Version)-2]
} else {
trimmedVersion = f.Go.Version
}

repoVersion, e := strconv.ParseFloat(trimmedVersion, 64)
repoVersion, e := strconv.ParseFloat(trimmedVersion, 64)

if e != nil {
return fmt.Errorf("failed to parse go version: %v", e)
}
if e != nil {
return fmt.Errorf("failed to parse go version: %v", e)
}

// We will begin enforcing this policy for go version 1.24 and above, for now set the minimum version to 1.23
var enforceGoVersionUpgrade float64 = 1.23
// We will begin enforcing this policy for go version 1.24 and above, for now set the minimum version to 1.23
var enforceGoVersionUpgrade float64 = 1.23

// trim the patch value from the latest go version
latestGoVersion = latestGoVersion[:len(latestGoVersion)-2]
newestGoVersion, e := strconv.ParseFloat(latestGoVersion, 64)
if e != nil {
return fmt.Errorf("failed to parse go version: %v", e)
}
// trim the patch value from the latest go version
latestGoVersion = latestGoVersion[:len(latestGoVersion)-2]
newestGoVersion, e := strconv.ParseFloat(latestGoVersion, 64)
if e != nil {
return fmt.Errorf("failed to parse go version: %v", e)
}

// Once 1.23 is no longer supported, we will enforce the policy for 1.24 and above
if (repoVersion <= enforceGoVersionUpgrade) && (enforceGoVersionUpgrade < newestGoVersion-0.01) {
return &ValidationError{Message: fmt.Sprintf("Your applications go version %v is no longer supported. Please upgrade to version %v.", repoVersion, newestGoVersion)}
} else if repoVersion <= newestGoVersion-0.01 {
// We'll give a PR comment to the Author to warn them about the need to upgrade
fmt.Printf("A new Go version is out, released on (%v). After 6 months of release, Your current Go version (%v) will fail CI workflows if it is not upgraded.\n", releaseDate, f.Go.Version)
}
// Once 1.23 is no longer supported, we will enforce the policy for 1.24 and above
if (repoVersion <= enforceGoVersionUpgrade) && (enforceGoVersionUpgrade < newestGoVersion-0.01) {
return &ValidationError{Message: fmt.Sprintf("Your applications go version %v is no longer supported. Please upgrade to version %v.", repoVersion, newestGoVersion)}
} else if repoVersion <= newestGoVersion-0.01 {
// We'll give a PR comment to the Author to warn them about the need to upgrade
fmt.Printf("A new Go version is out, released on (%v). After 6 months of release, Your current Go version (%v) will fail CI workflows if it is not upgraded.\n", releaseDate, f.Go.Version)
}
*/
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ require (
github.com/docker/docker v23.0.2+incompatible
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/moby/buildkit v0.11.5
golang.org/x/mod v0.25.0
golang.org/x/sync v0.15.0
gopkg.in/yaml.v3 v3.0.1
)
Expand Down Expand Up @@ -69,6 +68,7 @@ require (
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
go.mongodb.org/mongo-driver v1.17.4 // indirect
golang.org/x/mod v0.25.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/time v0.12.0 // indirect
Expand Down
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg6
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Clever/catapult/gen-go/models v1.206.0 h1:O338A6BsJXawrcj1YRDzceapfv7kWhGSo2n91S47Uoo=
github.com/Clever/catapult/gen-go/models v1.206.0/go.mod h1:a2Mjvx842kCgdnwgCbF8S361vdrDTeeDG/iowbCjkB0=
github.com/Clever/circle-ci-integrations/gen-go/client v0.0.0-20250515140338-c4907a8ff0c0 h1:hFKnyXa1O9DdMA270JK+8QLtEljl4p1VxMh3qHFmN6s=
github.com/Clever/circle-ci-integrations/gen-go/client v0.0.0-20250515140338-c4907a8ff0c0/go.mod h1:zfaHIz55lTkvsMS9jIL11l9szB8ThG0RenysMz35/e4=
github.com/Clever/circle-ci-integrations/gen-go/client v0.0.0-20251112223700-5c855479cbac h1:rWhJx24guNjw33aa3c/CHtCKpqqsak+uUvWlOOMGm6Y=
github.com/Clever/circle-ci-integrations/gen-go/client v0.0.0-20251112223700-5c855479cbac/go.mod h1:wpdliPGHx46byqcV9J05VN7JUoGb5NDZFxVt7PQpMQ0=
github.com/Clever/circle-ci-integrations/gen-go/client v0.14.0 h1:O4XAIg8zcree7X7WVqjc2+z1a9Z13eXiiFXE6xa5hEs=
github.com/Clever/circle-ci-integrations/gen-go/client v0.14.0/go.mod h1:wpdliPGHx46byqcV9J05VN7JUoGb5NDZFxVt7PQpMQ0=
github.com/Clever/circle-ci-integrations/gen-go/models v0.0.0-20250515140338-c4907a8ff0c0 h1:8Dz3nDusLZlF2Te4FdmLO2/J9WJ1rdCsd+7BuE/UCjw=
github.com/Clever/circle-ci-integrations/gen-go/models v0.0.0-20250515140338-c4907a8ff0c0/go.mod h1:mHbAHSsROUodDWapy/Po6KKrpmXzTl1DKIpRKTY2Yz0=
github.com/Clever/circle-ci-integrations/gen-go/models v0.0.0-20251112223700-5c855479cbac h1:NdpzsAyAzCmZMt+YQsEk6hHtAsf128qSmOuFbLRCsS4=
github.com/Clever/circle-ci-integrations/gen-go/models v0.0.0-20251112223700-5c855479cbac/go.mod h1:t6kpy0bDHmkDfPkxpoc1DE49mBfo0DbEh9e5MZAJDTc=
github.com/Clever/circle-ci-integrations/gen-go/models v0.14.0 h1:5Ys+a5lnL/GxEMxHHTu3BEjGcChQ/bFzlAHBP4zfoAo=
github.com/Clever/circle-ci-integrations/gen-go/models v0.14.0/go.mod h1:t6kpy0bDHmkDfPkxpoc1DE49mBfo0DbEh9e5MZAJDTc=
github.com/Clever/discovery-go v1.9.1 h1:4swV6hvVOeEVVVHkSaArczkrLlWfjXF+EtUfErcrFro=
Expand Down