mirror of
https://github.com/drone/drone-cli.git
synced 2026-01-22 19:11:34 +01:00
Merge branch 'master' into remove-unnecessary-lint-output
This commit is contained in:
commit
61ef02ac6c
24
CHANGELOG.md
24
CHANGELOG.md
@ -1,5 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
## [1.7.0](https://github.com/harness/drone-cli/tree/1.7.0) (2023-01-24)
|
||||
|
||||
[Full Changelog](https://github.com/harness/drone-cli/compare/v1.6.2...1.7.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Add support for jpath in jsonnet [\#224](https://github.com/harness/drone-cli/pull/224) ([rhiaxion](https://github.com/rhiaxion))
|
||||
|
||||
## [v1.6.2](https://github.com/harness/drone-cli/tree/v1.6.2) (2022-11-24)
|
||||
|
||||
[Full Changelog](https://github.com/harness/drone-cli/compare/v1.6.1...v1.6.2)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- fix: use right parameter name for secrets-file [\#226](https://github.com/harness/drone-cli/pull/226) ([kameshsampath](https://github.com/kameshsampath))
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- \(maint\) prep v1.6.2 [\#227](https://github.com/harness/drone-cli/pull/227) ([tphoney](https://github.com/tphoney))
|
||||
|
||||
## [v1.6.1](https://github.com/harness/drone-cli/tree/v1.6.1) (2022-10-21)
|
||||
|
||||
[Full Changelog](https://github.com/harness/drone-cli/compare/v1.6.0...v1.6.1)
|
||||
@ -8,6 +28,10 @@
|
||||
|
||||
- \(fix\) add secret file to compiler in exec [\#222](https://github.com/harness/drone-cli/pull/222) ([tphoney](https://github.com/tphoney))
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- \(maint\) release prep 1.6.1 & go tidy [\#223](https://github.com/harness/drone-cli/pull/223) ([tphoney](https://github.com/tphoney))
|
||||
|
||||
## [v1.6.0](https://github.com/harness/drone-cli/tree/v1.6.0) (2022-10-19)
|
||||
|
||||
[Full Changelog](https://github.com/harness/drone-cli/compare/v1.5.0...v1.6.0)
|
||||
|
||||
@ -16,8 +16,6 @@ You can generate a token by logging into your GitHub account and going to Settin
|
||||
|
||||
Next we tag the PR's with the fixes or enhancements labels. If the PR does not fufil the requirements, do not add a label.
|
||||
|
||||
** Before moving on make sure to update the version file `version/version.go`. **
|
||||
|
||||
Run the changelog generator again with the future version according to semver.
|
||||
|
||||
```BASH
|
||||
@ -34,3 +32,4 @@ Create your pull request for the release. Get it merged then tag the release.
|
||||
[Report or Track A Bug](https://community.harness.io/c/bugs/17) - Find a bug? Please report in our forum under Drone Bugs. Please provide screenshots and steps to reproduce.
|
||||
|
||||
[Events](https://www.meetup.com/harness/) - Keep up to date with Drone events and check out previous events [here](https://www.youtube.com/watch?v=Oq34ImUGcHA&list=PLXsYHFsLmqf3zwelQDAKoVNmLeqcVsD9o).
|
||||
|
||||
|
||||
@ -70,6 +70,10 @@ var Command = cli.Command{
|
||||
Name: "trusted",
|
||||
Usage: "build is trusted",
|
||||
},
|
||||
cli.BoolTFlag{
|
||||
Name: "pretty",
|
||||
Usage: "enable pretty printing",
|
||||
},
|
||||
cli.DurationFlag{
|
||||
Name: "timeout",
|
||||
Usage: "build timeout",
|
||||
|
||||
@ -47,12 +47,12 @@ type execCommand struct {
|
||||
PrivateKey string
|
||||
}
|
||||
|
||||
func mapOldToExecCommand(input *cli.Context) (returnVal *execCommand) {
|
||||
func mapOldToExecCommand(input *cli.Context) *execCommand {
|
||||
pipelineFile := input.Args().First()
|
||||
if pipelineFile == "" {
|
||||
pipelineFile = ".drone.yml"
|
||||
}
|
||||
returnVal = &execCommand{
|
||||
return &execCommand{
|
||||
Flags: &Flags{
|
||||
Build: &drone.Build{
|
||||
Event: input.String("event"),
|
||||
@ -85,12 +85,11 @@ func mapOldToExecCommand(input *cli.Context) (returnVal *execCommand) {
|
||||
Networks: input.StringSlice("network"),
|
||||
Environ: readParams(input.String("env-file")),
|
||||
Volumes: withVolumeSlice(input.StringSlice("volume")),
|
||||
Secrets: readParams(input.String("secrets")),
|
||||
Secrets: readParams(input.String("secret-file")),
|
||||
Config: input.String("registry"),
|
||||
Privileged: input.StringSlice("privileged"),
|
||||
Pretty: input.BoolT("pretty"),
|
||||
}
|
||||
|
||||
return returnVal
|
||||
}
|
||||
|
||||
// WithVolumeSlice is a transform function that adds a set of global volumes to the container that are defined in --volume=host:container format.
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/fatih/color"
|
||||
@ -14,7 +15,6 @@ import (
|
||||
"github.com/google/go-jsonnet"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
// Command exports the jsonnet command.
|
||||
var Command = cli.Command{
|
||||
Name: "jsonnet",
|
||||
@ -56,11 +56,22 @@ var Command = cli.Command{
|
||||
Name: "extVar, V",
|
||||
Usage: "Pass extVars to Jsonnet (can be specified multiple times)",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "jpath, J",
|
||||
Usage: "Specify an additional library search dir (right-most wins)",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func generate(c *cli.Context) error {
|
||||
result, err := convert(c.String("source"), c.Bool("string"), c.Bool("format"), c.Bool("stream"), c.StringSlice("extVar"))
|
||||
result, err := convert(
|
||||
c.String("source"),
|
||||
c.Bool("string"),
|
||||
c.Bool("format"),
|
||||
c.Bool("stream"),
|
||||
c.StringSlice("extVar"),
|
||||
c.StringSlice("jpath"),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -75,7 +86,7 @@ func generate(c *cli.Context) error {
|
||||
return ioutil.WriteFile(target, []byte(result), 0644)
|
||||
}
|
||||
|
||||
func convert(source string, stringOutput bool, format bool, stream bool, vars []string) (string, error) {
|
||||
func convert(source string, stringOutput bool, format bool, stream bool, vars []string, jpath []string) (string, error) {
|
||||
data, err := ioutil.ReadFile(source)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@ -92,6 +103,12 @@ func convert(source string, stringOutput bool, format bool, stream bool, vars []
|
||||
// register native functions
|
||||
RegisterNativeFuncs(vm)
|
||||
|
||||
jsonnetPath := filepath.SplitList(os.Getenv("JSONNET_PATH"))
|
||||
jsonnetPath = append(jsonnetPath, jpath...)
|
||||
vm.Importer(&jsonnet.FileImporter{
|
||||
JPaths: jsonnetPath,
|
||||
})
|
||||
|
||||
// extVars
|
||||
for _, v := range vars {
|
||||
name, value, err := getVarVal(v)
|
||||
|
||||
@ -14,6 +14,7 @@ func TestConvert(t *testing.T) {
|
||||
jsonnetFile, yamlFile string
|
||||
stringOutput, format, stream bool
|
||||
extVars []string
|
||||
jpath []string
|
||||
}{
|
||||
{
|
||||
name: "Stream + Format",
|
||||
@ -21,6 +22,13 @@ func TestConvert(t *testing.T) {
|
||||
yamlFile: "stream_format.yaml",
|
||||
format: true, stream: true,
|
||||
},
|
||||
{
|
||||
name: "Jsonnet Path",
|
||||
jsonnetFile: "stream_format.jsonnet",
|
||||
yamlFile: "stream_format.yaml",
|
||||
format: true, stream: true,
|
||||
jpath: []string{"/path/to/jsonnet/lib"},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
@ -29,7 +37,7 @@ func TestConvert(t *testing.T) {
|
||||
expected, err := os.ReadFile(filepath.Join("./testdata", tc.yamlFile))
|
||||
assert.NoError(t, err)
|
||||
|
||||
result, err := convert(filepath.Join("./testdata", tc.jsonnetFile), tc.stringOutput, tc.format, tc.stream, tc.extVars)
|
||||
result, err := convert(filepath.Join("./testdata", tc.jsonnetFile), tc.stringOutput, tc.format, tc.stream, tc.extVars, tc.jpath)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, string(expected), result)
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user