Skip to content

[chore]:Reuse API update - Migration from dep5 file to TOML file. #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions .buildvars.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
go_version: "1.20"
golangci_version: v1.52.2
go_version: "1.21"
golangci_version: v1.55.2
goreleaser_version: v1.16.2

coverage_min: 80
coverage_min: 80
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ on:
branches:
- '**'
- main
- v2
pull_request:
branches:
- '**'
- main
- v2
# on:
# push:
# tags:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches:
- "main"
- "v2"
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches:
- "main"
- "v2"
schedule:
- cron: '15 13 * * 2'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage-badge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
with:
filename: coverage.out
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v12
uses: tj-actions/verify-changed-files@v17
id: verify-changed-files
with:
files: README.md
Expand Down
28 changes: 13 additions & 15 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ run:
tests: true
skip-dirs-use-default: true
skip-files:
- ".*tmp/.*.go$"
- ".*tmp/.*.go$"
linters-settings:
depguard:
list-type: denylist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
- logutils.Log
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by the local log package"
- logutils.Log: "logging is allowed only by the local log package"
rules:
main:
deny:
- pkg: "github.com/sirupsen/logrus"
desc: "logging is allowed only by the local log package"
- pkg: "logutils.Log"
desc: "logging is allowed only by the local log package"
dupl:
threshold: 100
funlen:
Expand Down Expand Up @@ -47,10 +45,10 @@ linters-settings:
- condition
- return
ignored-numbers:
- '0'
- '1'
- '2'
- '3'
- "0"
- "1"
- "2"
- "3"
ignored-functions:
- strings.SplitN
revive:
Expand Down Expand Up @@ -124,4 +122,4 @@ linters:
# - nestif
# - prealloc
# - testpackage
# - wsl
# - wsl
8 changes: 4 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ builds:
ldflags:
- -extldflags '-static'
- -s -w
- -X github.com/SAP/configuration-tools-for-gitops/pkg/version.version={{.Version}}
- -X github.com/SAP/configuration-tools-for-gitops/pkg/version.gitCommit={{.Commit}}
- -X github.com/SAP/configuration-tools-for-gitops/pkg/version.buildDate={{.Date}}
- -X github.com/SAP/configuration-tools-for-gitops/pkg/version.gitTreeState=clean
- -X github.com/SAP/configuration-tools-for-gitops/v2/pkg/version.version={{.Version}}
- -X github.com/SAP/configuration-tools-for-gitops/v2/pkg/version.gitCommit={{.Commit}}
- -X github.com/SAP/configuration-tools-for-gitops/v2/pkg/version.buildDate={{.Date}}
- -X github.com/SAP/configuration-tools-for-gitops/v2/pkg/version.gitTreeState=clean


archives:
Expand Down
29 changes: 0 additions & 29 deletions .reuse/dep5

This file was deleted.

11 changes: 11 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version = 1
SPDX-PackageName = "configuration-tools-for-gitops"
SPDX-PackageSupplier = "[email protected]"
SPDX-PackageDownloadLocation = "https://github.com/SAP/configuration-tools-for-gitops"
SPDX-PackageComment = "The code in this project may include calls to APIs (\"API Calls\") of\n SAP or third-party products or services developed outside of this project\n (\"External Products\").\n \"APIs\" means application programming interfaces, as well as their respective\n specifications and implementing code that allows software to communicate with\n other software.\n API Calls to External Products are not licensed under the open source license\n that governs this project. The use of such API Calls and related External\n Products are subject to applicable additional agreements with the relevant\n provider of the External Products. In no event shall the open source license\n that governs this project grant any rights in or to any External Products,or\n alter, expand or supersede any terms of the applicable additional agreements.\n If you have a valid license agreement with SAP for the use of a particular SAP\n External Product, then you may make use of any API Calls included in this\n project's code for that SAP External Product, subject to the terms of such\n license agreement. If you do not have a valid license agreement for the use of\n a particular SAP External Product, then you may only make use of any API Calls\n in this project for that SAP External Product for your internal, non-productive\n and non-commercial test and evaluation of such API Calls. Nothing herein grants\n you any rights to use or access any SAP External Product, or provide any third\n parties the right to use of access any SAP External Product, through API Calls."

[[annotations]]
path = "**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2023 SAP SE or an SAP affiliate company and configuration-tools-for-gitops contributors"
SPDX-License-Identifier = "Apache-2.0"
20 changes: 7 additions & 13 deletions cmd/coco/commands/dependencies.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package commands

import (
"fmt"
"io"
"os"
"path/filepath"

"github.com/SAP/configuration-tools-for-gitops/cmd/coco/dependencies"
"github.com/SAP/configuration-tools-for-gitops/cmd/coco/graph"
"github.com/SAP/configuration-tools-for-gitops/pkg/log"
"github.com/SAP/configuration-tools-for-gitops/v2/cmd/coco/dependencies"
"github.com/SAP/configuration-tools-for-gitops/v2/cmd/coco/graph"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -48,8 +48,7 @@ func newDependencies() *cobra.Command {
var ok bool
format, ok = graph.CastOutputFormat(rawFormat)
if !ok {
log.Sugar.Errorf("illegal format %q", rawFormat)
os.Exit(1)
failOnError(fmt.Errorf("illegal format %q", rawFormat), "dependencies")
}
},
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -65,16 +64,11 @@ func newDependencies() *cobra.Command {
overWriteGitDepth, // viper.GetInt(gitDepth),
logLvl,
)
if err != nil {
log.Sugar.Errorf("dependency failed with: %s", err)
os.Exit(1)
}
failOnError(err, "dependencies")

writeTo, err := writeTarget(viper.GetString(gitPathKey), outputFile)
if err != nil {
log.Sugar.Errorf("dependency failed with: %s", err)
os.Exit(1)
}
failOnError(err, "dependencies")

changedDeps.Print(writeTo, format)
},
}
Expand Down
46 changes: 22 additions & 24 deletions cmd/coco/commands/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import (
"os"
"path/filepath"

"github.com/SAP/configuration-tools-for-gitops/cmd/coco/generate"
"github.com/SAP/configuration-tools-for-gitops/pkg/log"
"github.com/SAP/configuration-tools-for-gitops/pkg/version"
"github.com/SAP/configuration-tools-for-gitops/v2/cmd/coco/generate"
"github.com/SAP/configuration-tools-for-gitops/v2/pkg/log"
"github.com/SAP/configuration-tools-for-gitops/v2/pkg/version"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/zap"
)

var (
Expand Down Expand Up @@ -42,23 +41,22 @@ in the gitops repository.
Run: func(cmd *cobra.Command, args []string) {
basepath := viper.GetString(gitPathKey)
configFileName := viper.GetString(componentCfg)
err := generate.Generate(
basepath,
tmplIdentifier,
persistenceFlag,
configFileName,
version.ReadAll(),
cleanValuePaths(valuesFolders, basepath),
environmentFilter,
args,
excludeFolders,
logLvl,
takeControl,
failOnError(
generate.Generate(
basepath,
tmplIdentifier,
persistenceFlag,
configFileName,
version.ReadAll(),
cleanValuePaths(valuesFolders, basepath),
environmentFilter,
args,
excludeFolders,
logLvl,
takeControl,
),
"generate",
)
if err != nil {
log.Sugar.Errorf("generate failed: %s", err)
os.Exit(1)
}
},
}

Expand Down Expand Up @@ -92,10 +90,10 @@ or the yaml tag "!HumanInput" will not be overwritten.`,
`if this flag is set, coco takes control over all generated files regardless
of the version in the generated files`,
)
if err := c.Flags().MarkDeprecated("take-control", "please use \"--force\" instead"); err != nil {
zap.L().Sugar().Errorf("flag %q not found: %v", "take-control", err)
os.Exit(1)
}
failOnError(
c.Flags().MarkDeprecated("take-control", "please use \"--force\" instead"),
"generate",
)
c.Flags().BoolVar(
&takeControl, "force", false,
`if this flag is set, coco forcefully regenerats all files regardless of
Expand Down
20 changes: 10 additions & 10 deletions cmd/coco/commands/generateCustom.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package commands

import (
"os"
"fmt"

"github.com/SAP/configuration-tools-for-gitops/cmd/coco/generate"
"github.com/SAP/configuration-tools-for-gitops/pkg/log"
"github.com/SAP/configuration-tools-for-gitops/v2/cmd/coco/generate"
"github.com/spf13/cobra"
)

Expand All @@ -21,17 +20,18 @@ func newGenerateCustom() *cobra.Command {

Args: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
log.Sugar.Errorf("no go-template provided, please provide a template as argument")
os.Exit(1)
failOnError(
fmt.Errorf("no go-template provided, please provide a template as argument"),
"custom",
)
}
return nil
},
Run: func(cmd *cobra.Command, args []string) {
err := generate.ParseTemplate(args[0], customValues, customTarget)
if err != nil {
log.Sugar.Errorf("generate failed: %s", err)
os.Exit(1)
}
failOnError(
generate.ParseTemplate(args[0], customValues, customTarget),
"custom",
)
},
}

Expand Down
14 changes: 5 additions & 9 deletions cmd/coco/commands/graph.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package commands

import (
"fmt"
"os"

"github.com/SAP/configuration-tools-for-gitops/cmd/coco/dependencies"
"github.com/SAP/configuration-tools-for-gitops/cmd/coco/graph"
"github.com/SAP/configuration-tools-for-gitops/pkg/log"
"github.com/SAP/configuration-tools-for-gitops/v2/cmd/coco/dependencies"
"github.com/SAP/configuration-tools-for-gitops/v2/cmd/coco/graph"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand All @@ -27,19 +27,15 @@ func newGraph() *cobra.Command {
var ok bool
format, ok = graph.CastOutputFormat(rawFormat)
if !ok {
log.Sugar.Errorf("illegal format %q", rawFormat)
os.Exit(1)
failOnError(fmt.Errorf("illegal format %q", rawFormat), "graph")
}
},
Run: func(cmd *cobra.Command, args []string) {
deps, _, err := dependencies.Graph(
viper.GetString(gitPathKey),
viper.GetString(componentCfg),
)
if err != nil {
log.Sugar.Errorf("graph failed with: %s", err)
os.Exit(1)
}
failOnError(err, "graph")
deps.Print(os.Stdout, format)
},
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/coco/commands/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"os"

"github.com/SAP/configuration-tools-for-gitops/cmd/coco/inputfile"
"github.com/SAP/configuration-tools-for-gitops/pkg/yamlfile"
"github.com/SAP/configuration-tools-for-gitops/v2/cmd/coco/inputfile"
"github.com/SAP/configuration-tools-for-gitops/v2/pkg/yamlfile"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"gopkg.in/yaml.v3"
Expand Down
Loading
Loading