Skip to content

Commit 80e8b86

Browse files
CR-7821 (#159)
* bump and createIfNotExist * create-repo flag * create flag * newline * go mod tidy * conflict * flag name * make codegen
1 parent 5c8fde0 commit 80e8b86

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.0.151
1+
VERSION=v0.0.152
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

cmd/commands/git-source.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ func NewGitSourceCreateCommand() *cobra.Command {
111111
var (
112112
insCloneOpts *git.CloneOptions
113113
gsCloneOpts *git.CloneOptions
114+
createRepo bool
114115
)
115116

116117
cmd := &cobra.Command{
@@ -134,7 +135,7 @@ func NewGitSourceCreateCommand() *cobra.Command {
134135
if gsCloneOpts.Repo == "" {
135136
log.G(ctx).Fatal("must enter a valid value to --git-src-repo. Example: https://github.com/owner/repo-name/path/to/workflow")
136137
}
137-
138+
138139
err := ensureRepo(cmd, args[0], insCloneOpts, true)
139140
if err != nil {
140141
return err
@@ -153,8 +154,13 @@ func NewGitSourceCreateCommand() *cobra.Command {
153154
gsCloneOpts.Auth.Password = insCloneOpts.Auth.Password
154155
}
155156

157+
if createRepo {
158+
gsCloneOpts.CreateIfNotExist = createRepo
159+
}
160+
156161
insCloneOpts.Parse()
157162
gsCloneOpts.Parse()
163+
158164
return nil
159165
},
160166
RunE: func(cmd *cobra.Command, args []string) error {
@@ -174,6 +180,8 @@ func NewGitSourceCreateCommand() *cobra.Command {
174180
},
175181
}
176182

183+
cmd.Flags().BoolVar(&createRepo, "create-repo", false, "If true, will create the specified git-source repo in case it doesn't already exist")
184+
177185
insCloneOpts = apu.AddCloneFlags(cmd, &apu.CloneFlagsOptions{})
178186
gsCloneOpts = apu.AddCloneFlags(cmd, &apu.CloneFlagsOptions{
179187
Prefix: "git-src",
@@ -185,6 +193,7 @@ func NewGitSourceCreateCommand() *cobra.Command {
185193

186194
func RunGitSourceCreate(ctx context.Context, opts *GitSourceCreateOptions) error {
187195
// upsert git-source repo
196+
188197
gsRepo, gsFs, err := opts.GsCloneOpts.GetRepo(ctx)
189198
if err != nil {
190199
return fmt.Errorf("failed to clone git-source repo: %w", err)
@@ -542,7 +551,7 @@ func NewGitSourceEditCommand() *cobra.Command {
542551
if gsCloneOpts.Repo == "" {
543552
log.G(ctx).Fatal("must enter a valid value to --git-src-repo. Example: https://github.com/owner/repo-name/path/to/workflow")
544553
}
545-
554+
546555
err := ensureRepo(cmd, args[0], insCloneOpts, true)
547556
if err != nil {
548557
return err

docs/commands/cli-v2_git-source_create.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ cli-v2 git-source create runtime_name git-source_name [flags]
1717
### Options
1818

1919
```
20+
--create-repo If true, will create the specified git-source repo in case it doesn't already exist
2021
--git-src-git-token string Your git provider api token [GIT_SRC_GIT_TOKEN]
2122
--git-src-git-user string Your git provider user name [GIT_SRC_GIT_USER] (not required in GitHub)
2223
--git-src-repo string Repository URL [GIT_SRC_GIT_REPO]

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cf version
2020
### Linux
2121
```bash
2222
# download and extract the binary
23-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.151/cf-linux-amd64.tar.gz | tar zx
23+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.152/cf-linux-amd64.tar.gz | tar zx
2424

2525
# move the binary to your $PATH
2626
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -32,7 +32,7 @@ cf version
3232
### Mac
3333
```bash
3434
# download and extract the binary
35-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.151/cf-darwin-amd64.tar.gz | tar zx
35+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.152/cf-darwin-amd64.tar.gz | tar zx
3636

3737
# move the binary to your $PATH
3838
mv ./cf-darwin-amd64 /usr/local/bin/cf

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.16
55
require (
66
github.com/Masterminds/semver/v3 v3.1.1
77
github.com/argoproj-labs/applicationset v0.2.0
8-
github.com/argoproj-labs/argocd-autopilot v0.2.26
8+
github.com/argoproj-labs/argocd-autopilot v0.2.27
99
github.com/argoproj/argo-cd/v2 v2.1.2
1010
github.com/argoproj/argo-events v1.4.0
1111
github.com/argoproj/argo-workflows/v3 v3.1.6

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ github.com/ardielle/ardielle-go v1.5.2/go.mod h1:I4hy1n795cUhaVt/ojz83SNVCYIGsAF
172172
github.com/ardielle/ardielle-tools v1.5.4/go.mod h1:oZN+JRMnqGiIhrzkRN9l26Cej9dEx4jeNG6A+AdkShk=
173173
github.com/argoproj-labs/applicationset v0.2.0 h1:yq3u88VtH9bXAl8DkIzBi0Q5FCe/ExZHlnGHDxxsyY4=
174174
github.com/argoproj-labs/applicationset v0.2.0/go.mod h1:vElTdgajynEAIRuQMqQwYWSWTbdgrQPW6zDsxNPs+NE=
175-
github.com/argoproj-labs/argocd-autopilot v0.2.26 h1:5iB85rvXCh0v5jtX+gnEjvq6Anat9ADr4Bm5iZTttsQ=
176-
github.com/argoproj-labs/argocd-autopilot v0.2.26/go.mod h1:GjkycwSEKpDJaxHMz0gfIclRIdmHiSW7p9U2mR+We6Q=
175+
github.com/argoproj-labs/argocd-autopilot v0.2.27 h1:mENBxlfLV1waksrScxPlWEoIg9b2M7cizU++LBW5mrg=
176+
github.com/argoproj-labs/argocd-autopilot v0.2.27/go.mod h1:GjkycwSEKpDJaxHMz0gfIclRIdmHiSW7p9U2mR+We6Q=
177177
github.com/argoproj/argo-cd/v2 v2.1.0-rc2/go.mod h1:a21F1IEszRrCLvXXYc1sML3mjlMN3pp6rpDxy+7E0os=
178178
github.com/argoproj/argo-cd/v2 v2.1.0/go.mod h1:/e8fSyHanaAHLR5YsIIWfCGujTN452K6L7DaYep5KRU=
179179
github.com/argoproj/argo-cd/v2 v2.1.2 h1:Ls+nJQJ7HWHeg9AKtFeeUCQTsSFvzDpbZq+ALxHL680=

manifests/runtime.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
namespace: "{{ namespace }}"
66
spec:
77
defVersion: 1.0.0
8-
version: 0.0.151
8+
version: 0.0.152
99
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
1010
components:
1111
- name: events

0 commit comments

Comments
 (0)