Skip to content

Commit c020bdb

Browse files
authored
Merge pull request #314 from chmouel/multiple-other-fixes-with-bootstrap
2 parents f0e4864 + 341f407 commit c020bdb

File tree

8 files changed

+34
-24
lines changed

8 files changed

+34
-24
lines changed

β€ŽDockerfileβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LABEL com.redhat.component=pipelines-as-code \
1111
1212
summary="This image is to run Pipelines as Code task"
1313

14-
LABEL version=0.4.1
14+
LABEL version=0.4.3
1515

1616
COPY --from=builder /tmp/pipelines-as-code /usr/bin/pipelines-as-code
1717
RUN ln /usr/bin/pipelines-as-code /usr/bin/tkn-pac

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**This documentation refers to the main developement branch, the documentation for the released version is [here](https://github.com/openshift-pipelines/pipelines-as-code/blob/0.4.1/README.md)**
1+
**This documentation refers to the main developement branch, the documentation for the released version is [here](https://github.com/openshift-pipelines/pipelines-as-code/blob/0.4.3/README.md)**
22

33
# Pipelines as Code
44

β€Ždocs/INSTALL.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Here is a video walkthrough on the install process :
2424
To install Pipelines as Code on your cluster you simply need to run this command :
2525

2626
```shell
27-
VERSION=0.4.1
27+
VERSION=0.4.3
2828
kubectl apply -f https://raw.githubusercontent.com/openshift-pipelines/pipelines-as-code/release-$VERSION/release-$VERSION.yaml
2929
```
3030

@@ -313,7 +313,7 @@ its [interceptors](https://storage.googleapis.com/tekton-releases/triggers/lates
313313
The release yaml to install pipelines are for the relesaed version :
314314

315315
```shell
316-
VERSION=0.4.1
316+
VERSION=0.4.3
317317
kubectl apply -f https://raw.githubusercontent.com/openshift-pipelines/pipelines-as-code/release-$VERSION/release-$VERSION.k8s.yaml
318318
```
319319

β€Žpkg/cmd/bootstrap/bootstrap.goβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ func createSecret(ctx context.Context, run *params.Run, opts *bootstrapOpts) err
8686
return err
8787
}
8888
}
89-
9089
jeez, err := generateManifest(opts)
9190
if err != nil {
9291
return err

β€Žpkg/cmd/bootstrap/github.goβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ func generateManifest(opts *bootstrapOpts) ([]byte, error) {
4040

4141
// getGHClient get github client
4242
func getGHClient(opts *bootstrapOpts) (*github.Client, error) {
43-
if opts.GithubAPIURL == "" {
44-
opts.GithubAPIURL = "https://github.com"
43+
if opts.GithubAPIURL == defaultPublicGithub {
4544
return github.NewClient(nil), nil
4645
}
4746

β€Žpkg/cmd/bootstrap/install.goβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func installPac(ctx context.Context, opts *bootstrapOpts) error {
5656
}
5757
}
5858

59-
doinstall, err := askYN(opts, "πŸ•΅οΈ Pipelines as Code doesn't seem installed", fmt.Sprintf("Do you want me to install Pipelines as Code %s?", latestversion))
59+
doinstall, err := askYN(opts, true, "πŸ•΅οΈ Pipelines as Code doesn't seem installed", fmt.Sprintf("Do you want me to install Pipelines as Code %s?", latestversion))
6060
if err != nil {
6161
return err
6262
}
@@ -69,6 +69,6 @@ func installPac(ctx context.Context, opts *bootstrapOpts) error {
6969
}
7070

7171
// nolint:forbidigo
72-
fmt.Printf("βœ… Pipelines-as-Code %s has been installed\n", latestversion)
72+
fmt.Printf("βœ“ Pipelines-as-Code %s has been installed\n", latestversion)
7373
return nil
7474
}

β€Žpkg/cmd/bootstrap/questions.goβ€Ž

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,22 @@ package bootstrap
22

33
import (
44
"fmt"
5+
"strings"
56

67
"github.com/AlecAivazis/survey/v2"
78
)
89

9-
func askYN(opts *bootstrapOpts, title, question string) (bool, error) {
10+
const defaultPublicGithub = "https://github.com"
11+
12+
func askYN(opts *bootstrapOpts, deflt bool, title, question string) (bool, error) {
1013
var answer bool
1114
// nolint:forbidigo
1215
fmt.Printf("%s\n", title)
1316
err := opts.cliOpts.Ask([]*survey.Question{
1417
{
1518
Prompt: &survey.Confirm{
1619
Message: question,
20+
Default: deflt,
1721
},
1822
},
1923
}, &answer)
@@ -29,7 +33,7 @@ func askQuestions(opts *bootstrapOpts) error {
2933
var qs []*survey.Question
3034

3135
if opts.recreateSecret {
32-
answer, err := askYN(opts,
36+
answer, err := askYN(opts, false,
3337
fmt.Sprintf("πŸ‘€ A secret named %s in %s namespace has been detected.", secretName, opts.targetNamespace),
3438
"Do you want me to override the secret?")
3539
if err != nil {
@@ -43,23 +47,22 @@ func askQuestions(opts *bootstrapOpts) error {
4347
if opts.vcsType == "github-enteprise-app" {
4448
prompt := "Enter your Github enteprise API URL: "
4549
qs = append(qs, &survey.Question{
46-
Name: "GithubAPIURL",
47-
Prompt: &survey.Input{Message: prompt},
50+
Name: "GithubAPIURL",
51+
Prompt: &survey.Input{
52+
Message: prompt,
53+
},
54+
Validate: survey.Required,
4855
})
56+
} else {
57+
opts.GithubAPIURL = defaultPublicGithub
4958
}
5059

5160
prompt := "Enter the name of your GitHub application: "
5261
if opts.GithubApplicationName == "" {
5362
qs = append(qs, &survey.Question{
54-
Name: "GithubApplicationName",
55-
Prompt: &survey.Input{Message: prompt},
56-
})
57-
}
58-
if opts.GithubApplicationURL == "" {
59-
prompt = "Enter an URL for your GitHub application"
60-
qs = append(qs, &survey.Question{
61-
Name: "GithubApplicationURL",
62-
Prompt: &survey.Input{Message: prompt},
63+
Name: "GithubApplicationName",
64+
Prompt: &survey.Input{Message: prompt},
65+
Validate: survey.Required,
6366
})
6467
}
6568

@@ -68,8 +71,12 @@ func askQuestions(opts *bootstrapOpts) error {
6871
return err
6972
}
7073

74+
if !strings.HasPrefix(opts.GithubAPIURL, "https") {
75+
opts.GithubAPIURL = "https://" + strings.Trim(opts.GithubAPIURL, "/")
76+
}
77+
7178
if opts.RouteName != "" {
72-
answer, err := askYN(opts,
79+
answer, err := askYN(opts, true,
7380
fmt.Sprintf("πŸ‘€ We have detected an OpenShift Route on: %s", opts.RouteName),
7481
"Do you want me to use it?")
7582
if err != nil {
@@ -86,12 +93,17 @@ func askQuestions(opts *bootstrapOpts) error {
8693
Prompt: &survey.Input{
8794
Message: "Enter your public route URL: ",
8895
},
96+
Validate: survey.Required,
8997
},
9098
}, &opts.RouteName)
9199
if err != nil {
92100
return err
93101
}
94102
}
95103

104+
if opts.GithubApplicationURL == "" {
105+
opts.GithubApplicationURL = opts.RouteName
106+
}
107+
96108
return nil
97109
}

β€Žpkg/cmd/bootstrap/web.goβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func startWebServer(ctx context.Context, opts *bootstrapOpts, run *params.Run, j
7878
}
7979

8080
// nolint:forbidigo
81-
fmt.Printf("πŸš€ You can now add your newly created application on your repository by going to this URL:\n%s\n", *manifest.HTMLURL)
81+
fmt.Printf("πŸš€ You can now add your newly created application on your repository by going to this URL:\n%s\n\n", *manifest.HTMLURL)
8282

8383
// nolint:forbidigo
8484
fmt.Println("πŸ’‘ Don't forget to run the \"tkn pac repo create\" to create a new Repository CRD on your cluster.")

0 commit comments

Comments
Β (0)