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

armory / dinghy / 9704674769

27 Jun 2024 10:54PM UTC coverage: 41.534% (-13.0%) from 54.581%
9704674769

Pull #187

github

jasonmcintosh
fix: Builds to use parallel checks
Pull Request #187: chore: Upgrade to golang 1.22, sprout vs. spring, and other updates and fixes plus plank upgrade to fix deletes

8 of 22 new or added lines in 8 files covered. (36.36%)

1 existing line in 1 file now uncovered.

2252 of 5422 relevant lines covered (41.53%)

14.59 hits per line

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

0.0
/pkg/execution/execution.go
1
/*
2
* Copyright 2020 Armory, Inc.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
6
*    http://www.apache.org/licenses/LICENSE-2.0
7
* Unless required by applicable law or agreed to in writing, software
8
* distributed under the License is distributed on an "AS IS" BASIS,
9
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
* See the License for the specific language governing permissions and
11
* limitations under the License.
12
 */
13

14
package execution
15

16
import (
17
        "github.com/armory/dinghy/pkg/database"
18
        "time"
19
)
20

21
type Execution interface {
22
        Execute() (map[string]interface{}, error)
23
        CanExecute() bool
24
        ExecutionName() string
25
        CreateExecution(sqlClient *database.SQLClient, executionName string) error
26
        UpdateExecution(sqlClient *database.SQLClient, executionName string, result string, success bool) error
27
        Finalize()
28
}
29

NEW
30
func CreateExecution(sqlClient *database.SQLClient, executionName string) error {
×
31
        nanos := time.Now().UnixNano()
×
32
        milis := nanos / 1000000
×
33
        execution := database.ExecutionSQL{
×
34
                Execution:       executionName,
×
35
                Result:          "",
×
36
                Success:         "false",
×
37
                LastUpdatedDate: int(milis),
×
38
        }
×
39
        return sqlClient.Client.Create(&execution).Error
×
40
}
×
41

NEW
42
func UpdateExecution(sqlClient *database.SQLClient, executionName string, result string, success bool) error {
×
43
        nanos := time.Now().UnixNano()
×
44
        milis := nanos / 1000000
×
45
        succVal := "false"
×
46
        if success {
×
47
                succVal = "true"
×
48
        }
×
49
        execution := database.ExecutionSQL{
×
50
                Execution:       executionName,
×
51
                Result:          result,
×
52
                Success:         succVal,
×
53
                LastUpdatedDate: int(milis),
×
54
        }
×
55
        return sqlClient.Client.Save(&execution).Error
×
56
}
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