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

mendersoftware / mender-server / 1802588196

06 May 2025 10:48AM UTC coverage: 66.322% (+1.0%) from 65.288%
1802588196

Pull #631

gitlab-ci

lluiscampos
feat(create-artifact-worker): Update `mender-artifact` to latest v4.1.0

Modifying also the integration to build the tool from source instead or
repurposing the upstream Debian package. This has the main advantage
that we can compile it statically (by disabling a feature that we don't
use) and that we have control of the compatibility aspects of the
binary.

Ticket: MEN-8337

Signed-off-by: Lluis Campos <lluis.campos@northern.tech>
Pull Request #631: MEN-8337: feat(create-artifact-worker): Update `mender-artifact` to latest v4.1.0

29522 of 44513 relevant lines covered (66.32%)

1.45 hits per line

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

85.19
/backend/services/workflows/store/mongo/migrations.go
1
// Copyright 2021 Northern.tech AS
2
//
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
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
package mongo
16

17
import (
18
        "context"
19

20
        "github.com/pkg/errors"
21
        "go.mongodb.org/mongo-driver/mongo"
22

23
        "github.com/mendersoftware/mender-server/pkg/log"
24
        "github.com/mendersoftware/mender-server/pkg/mongo/migrate"
25
)
26

27
const (
28
        // DbVersion is the current schema version
29
        DbVersion = "1.0.0"
30
)
31

32
// Migrate applies migrations to the database
33
func Migrate(ctx context.Context,
34
        db string,
35
        version string,
36
        client *mongo.Client,
37
        automigrate bool) error {
3✔
38
        l := log.FromContext(ctx)
3✔
39

3✔
40
        l.Infof("migrating %s", db)
3✔
41

3✔
42
        ver, err := migrate.NewVersion(version)
3✔
43
        if err != nil {
3✔
44
                return errors.Wrap(err, "failed to parse service version")
×
45
        }
×
46

47
        m := migrate.SimpleMigrator{
3✔
48
                Client:      client,
3✔
49
                Db:          db,
3✔
50
                Automigrate: automigrate,
3✔
51
        }
3✔
52

3✔
53
        migrations := []migrate.Migration{
3✔
54
                &migration1_0_0{
3✔
55
                        client: client,
3✔
56
                        db:     db,
3✔
57
                },
3✔
58
        }
3✔
59

3✔
60
        err = m.Apply(ctx, *ver, migrations)
3✔
61
        if err != nil {
3✔
62
                return errors.Wrap(err, "failed to apply migrations")
×
63
        }
×
64

65
        return nil
3✔
66
}
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