-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add support to print information about newly upgraded Jenkins #593
Conversation
Codecov Report
@@ Coverage Diff @@
## master #593 +/- ##
=======================================
Coverage 37.98% 37.98%
=======================================
Files 13 13
Lines 416 416
=======================================
Hits 158 158
Misses 246 246
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
app/cmd/center_list_test.go
Outdated
err = ioutil.WriteFile(rootOptions.ConfigFile, data, 0664) | ||
Expect(err).To(BeNil()) | ||
|
||
resp, _ := http.Get(LTSURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any real network request should not be here. We cannot guarantee all environments have internet access.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I am going to change this.
app/cmd/center_list.go
Outdated
"strings" | ||
) | ||
|
||
const LTSURL = "https://www.jenkins.io/changelog-stable/rss.xml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I have changed this part.
app/cmd/center_list_test.go
Outdated
err = ioutil.WriteFile(rootOptions.ConfigFile, data, 0664) | ||
Expect(err).To(BeNil()) | ||
|
||
resp, _ := http.Get(LTSURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the LTSURL
value defined??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the center_list.go. The LTSURL is a constant and I changed the name from LTSURL to LtsUrl. But I haven't changed the test file. I will have it done in a few days
app/cmd/center_list_test.go
Outdated
var centerListOption CenterListOption | ||
xml.Unmarshal(bytes, ¢erListOption) | ||
theNewestJenkinsVersion := centerListOption.Channel.Items[0].Title[8:] | ||
temp, _ := printChangelog(LTSURL, theNewestJenkinsVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jxr98 , thanks for your contribution. I found some small issues. Please take a look at it. And please don't forget to check the CI status from GitHub. The status of Lint was failed.
By the way, the e2e tests have a big chance to fail. So I suggest that we can skip them for now. See also https://github.com/jenkins-zh/jenkins-cli/blob/master/.github/workflows/e2e-test.yaml
app/cmd/center_list_test.go
Outdated
@@ -1,6 +1,7 @@ | |||
package cmd | |||
|
|||
import ( | |||
bytes2 "bytes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you give it an alias bytes2
?
app/cmd/center_list_test.go
Outdated
</rss>` | ||
} | ||
|
||
func resultOneVersionData() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't block here. But a better way might be putting these strings into a file. Golang allows us to embed files into the binary file.
Refs
app/cmd/center_list.go
Outdated
//the number of lines to be printed in description column | ||
const NumberOfLinesOfDescription = 10 | ||
//ASCII of line feed | ||
const AsciiOfLineFeed = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jxr98 Please check the tips from hound.
app/cmd/center_list.go
Outdated
//ASCII of line feed | ||
const AsciiOfLineFeed = 10 | ||
//ASCII of space | ||
const AsciiOfSpace = 32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jxr98 Please check the tips from hound.
The reason why the e2e test failed this time was the go version used by this project was 1.15, but "embed" was added in go 1.16. I am gonna find a solution. |
We can use go 1.16 |
If you are sure that go 1.16 version can be tested normally in e2e, we can update the test dependency version to 1.16. |
#599 I already pull request to update e2e go version |
Hello @LinuxSuRen! Sorry to bother you. The e2e test failed again after I pulled from origin and resolved the conflict. The TestPowerShellCompletion failed and I have no idea what the reason is. Could you please give me a little hint on it? Thanks so much. |
Let's forget about the e2e tests for now. |
All right. |
c1108ec
to
b50df06
Compare
It would be better if you can tell us how to test this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel confused about the following output. Maybe for many users, they just don't know what they should do next. So, it would be great to have more information about your CLI:
gitpod /workspace/jenkins-cli $ ./jcli center list
Error: Get "http://localhost:8080/jenkins/api/json": dial tcp [::1]:8080: connect: connection refused
I will figure this out tomorrow. |
Make sure that you've checked the boxes below before you submit PR:
Always
For the bug fixes or features only