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

mendersoftware / integration-test-runner / 1583018314

10 Dec 2024 11:26PM UTC coverage: 68.703%. Remained the same
1583018314

Pull #336

gitlab-ci

danielskinstad
ci: pin docker to v27.3

Fixes runc errors in the hetzner runner
Use dependency proxy

Ticket: QA-823

Signed-off-by: Daniel Skinstad Drabitzius <daniel.drabitzius@northern.tech>
Pull Request #336: ci: pin docker to v27.3

1732 of 2521 relevant lines covered (68.7%)

2.49 hits per line

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

83.75
/menderqa_pipeline_helpers.go
1
package main
2

3
import (
4
        "fmt"
5
        "os/exec"
6
        "strings"
7

8
        "github.com/sirupsen/logrus"
9
)
10

11
func getServiceRevisionFromIntegration(repo, baseBranch string, conf *config) (string, error) {
13✔
12
        c := exec.Command(
13✔
13
                "python3",
13✔
14
                "release_tool.py",
13✔
15
                "--version-of",
13✔
16
                repo,
13✔
17
                "--in-integration-version",
13✔
18
                baseBranch,
13✔
19
        )
13✔
20
        c.Dir = conf.integrationDirectory + "/extra/"
13✔
21
        out, err := c.Output()
13✔
22
        if err != nil {
13✔
23
                err = fmt.Errorf("getServiceRevisionFromIntegration: Error: %v (%s)", err, out)
×
24
        }
×
25
        version := string(out)
13✔
26

13✔
27
        // remove the remote (ex: "`origin`/1.0.x")
13✔
28
        if strings.Contains(version, "/") {
14✔
29
                version = strings.SplitN(version, "/", 2)[1]
1✔
30
        }
1✔
31
        return strings.TrimSpace(string(version)), err
13✔
32
}
33

34
// The parameter that the build system uses for repo specific revisions is <REPO_NAME>_REV
35
func repoToBuildParameter(repo string) string {
1✔
36
        repoRevision := strings.ToUpper(repo) + "_REV"
1✔
37
        return strings.Replace(repoRevision, "-", "_", -1)
1✔
38
}
1✔
39

40
// Use python script in order to determine which integration branches to test with
41
func getIntegrationVersionsUsingMicroservice(
42
        log *logrus.Entry,
43
        repo, version string,
44
        conf *config,
45
) ([]string, error) {
1✔
46
        cmdArgs := []string{
1✔
47
                "release_tool.py",
1✔
48
                "--integration-versions-including",
1✔
49
                repo,
1✔
50
                "--version",
1✔
51
                version,
1✔
52
        }
1✔
53
        if strings.HasPrefix(version, featureBranchPrefix) {
1✔
54
                cmdArgs = append(cmdArgs, "--feature-branches")
×
55
        }
×
56
        c := exec.Command("python3", cmdArgs...)
1✔
57
        c.Dir = conf.integrationDirectory + "/extra/"
1✔
58
        integrations, err := c.Output()
1✔
59

1✔
60
        if err != nil {
1✔
61
                return nil, fmt.Errorf(
×
62
                        "getIntegrationVersionsUsingMicroservice: Error: %v (%s)",
×
63
                        err,
×
64
                        integrations,
×
65
                )
×
66
        }
×
67

68
        branches := strings.Split(strings.TrimSpace(string(integrations)), "\n")
1✔
69

1✔
70
        // remove the remote (ex: "`origin`/1.0.x")
1✔
71
        for idx, branch := range branches {
2✔
72
                if strings.Contains(branch, "/") {
2✔
73
                        branches[idx] = strings.Split(branch, "/")[1]
1✔
74
                }
1✔
75
        }
76

77
        // filter out "staging" branch if version is "master"
78
        // Reasoning: integration/staging will have "master" versions for client side
79
        // unreleased components, making the bot trigger two pipelines, wasting
80
        // resources and confusing developers...
81
        i := 0
1✔
82
        for _, branch := range branches {
2✔
83
                if version == "master" && branch == "staging" {
1✔
84
                        continue
×
85
                }
86
                branches[i] = branch
1✔
87
                i++
1✔
88

89
        }
90
        branches = branches[:i]
1✔
91

1✔
92
        log.Infof("%s/%s is being used in the following integration: %s", repo, version, branches)
1✔
93
        return branches, nil
1✔
94
}
95

96
func getListOfVersionedRepositories(inVersion string, conf *config) ([]string, error) {
1✔
97
        c := exec.Command("python3", "release_tool.py", "--list", "--in-integration-version", inVersion)
1✔
98
        c.Dir = conf.integrationDirectory + "/extra/"
1✔
99
        output, err := c.Output()
1✔
100
        if err != nil {
1✔
101
                return nil, fmt.Errorf("getListOfVersionedRepositories: Error: %v (%s)", err, output)
×
102
        }
×
103

104
        return strings.Split(strings.TrimSpace(string(output)), "\n"), nil
1✔
105
}
106

107
func getListOfAllRepositories(conf *config) ([]string, error) {
3✔
108
        c := exec.Command("python3", "release_tool.py", "--list", "--all")
3✔
109
        c.Dir = conf.integrationDirectory + "/extra/"
3✔
110
        output, err := c.Output()
3✔
111
        if err != nil {
5✔
112
                return nil, fmt.Errorf("getListOfAllRepositories: Error: %v (%s)", err, output)
2✔
113
        }
2✔
114

115
        return strings.Split(strings.TrimSpace(string(output)), "\n"), nil
1✔
116
}
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