• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mesosphere / kommander-applications / 13758145378

10 Mar 2025 06:17AM UTC coverage: 51.703%. First build
13758145378

Pull #3264

github

web-flow
Merge f5ac79940 into 0a2ce973b
Pull Request #3264: Sandy/backport release 2.13/pr 3241

167 of 323 relevant lines covered (51.7%)

221.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.22
/hack/release/pkg/upgradematrix/upgradematrix.go
1
package upgradematrix
2

3
import (
4
        "context"
5
        "errors"
6
        "log"
7
        "os"
8
        "path/filepath"
9
        "strings"
10
)
11

12
const (
13
        upgradeMatrixEnv  = "NKP_RELEASE_AUTOMATION_UPGRADE_MATRIX"
14
        upgradeMatrixFile = "upgrade-matrix.yaml"
15
)
16

17
var ErrIncorrectFormat = errors.New("upgrade matrix does not appear to be in the correct format, unable to update upgrade-matrix.yaml")
18

19
// UpdateUpgradeMatrix updates the upgrade-matrix.yaml file in the kommander-applications repository with the contents \
20
// of the upgradeMatrixEnv environment variable.
21
func UpdateUpgradeMatrix(ctx context.Context, kommanderApplicationsRepo string) error {
2✔
22
        // Get the upgrade matrix environment variable
2✔
23
        upgradeMatrix := os.Getenv(upgradeMatrixEnv)
2✔
24
        if upgradeMatrix == "" {
3✔
25
                log.Printf("upgrade matrix environment variable %s is empty, unable to update upgrade-matrix.yaml", upgradeMatrixEnv)
1✔
26
                return nil
1✔
27
        }
1✔
28

29
        // Check that upgradeMatrix appears to be correct
30
        if !strings.HasPrefix(upgradeMatrix, "upgrades:") {
1✔
31
                return ErrIncorrectFormat
×
32
        }
×
33

34
        // Write the upgrade matrix to the file
35
        err := os.WriteFile(filepath.Join(kommanderApplicationsRepo, upgradeMatrixFile), []byte(upgradeMatrix), 0644)
1✔
36
        if err != nil {
1✔
37
                log.Print("cannot write upgrade-matrix.yaml")
×
38
                return err
×
39
        }
×
40

41
        log.Print("Updated upgrade matrix")
1✔
42

1✔
43
        return nil
1✔
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc