Merge pull request #6 from Jotschi/fix-broken-urls

Fix various broken images
This commit is contained in:
bassrock 2014-07-31 09:30:16 -07:00
commit 2645819d46
2 changed files with 17 additions and 12 deletions

View File

@ -1,4 +1,4 @@
gitlab-jenkins-plugin
gitlab-plugin
=====================
This plugin emulates Jenkins as a GitlabCI Web Service to be used with GitlabHQ.
@ -68,7 +68,7 @@ Known Issues
Contributing
=====================
1. Fork it ( https://github.com/[my-github-username]/gitlab-jenkins-plugin/fork )
1. Fork it ( https://github.com/[my-github-username]/gitlab-plugin/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)

View File

@ -213,32 +213,37 @@ public class GitLabWebHook implements UnprotectedRootAction {
mainBuild = this.getBuildBySHA1(project, commitSHA1, false);
}
String baseUrl = Jenkins.getInstance().getRootUrl();
// Remove trailing slash
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
}
if(mainBuild == null) {
rsp.sendRedirect2(Jenkins.getInstance().getRootUrl() + "/plugin/gitlab-jenkins/images/unknown.png");
rsp.sendRedirect2(baseUrl + "/plugin/gitlab-plugin/images/unknown.png");
return;
}
BallColor currentBallColor = mainBuild.getIconColor().noAnime();
if(mainBuild.isBuilding()) {
rsp.sendRedirect2(Jenkins.getInstance().getRootUrl() + "/plugin/gitlab-jenkins/images/running.png");
rsp.sendRedirect2(baseUrl + "/plugin/gitlab-plugin/images/running.png");
}else if(currentBallColor == BallColor.BLUE) {
rsp.sendRedirect2(Jenkins.getInstance().getRootUrl() + "/plugin/gitlab-jenkins/images/success.png");
rsp.sendRedirect2(baseUrl + "/plugin/gitlab-plugin/images/success.png");
}else if(currentBallColor == BallColor.ABORTED) {
rsp.sendRedirect2(Jenkins.getInstance().getRootUrl() + "/plugin/gitlab-jenkins/images/unknown.png");
rsp.sendRedirect2(baseUrl + "/plugin/gitlab-plugin/images/unknown.png");
}else if(currentBallColor == BallColor.DISABLED) {
rsp.sendRedirect2(Jenkins.getInstance().getRootUrl() + "/plugin/gitlab-jenkins/images/unknown.png");
rsp.sendRedirect2(baseUrl + "/plugin/gitlab-plugin/images/unknown.png");
}else if(currentBallColor == BallColor.GREY) {
rsp.sendRedirect2(Jenkins.getInstance().getRootUrl() + "/plugin/gitlab-jenkins/images/unknown.png");
rsp.sendRedirect2(baseUrl + "/plugin/gitlab-plugin/images/unknown.png");
}else if(currentBallColor == BallColor.NOTBUILT) {
rsp.sendRedirect2(Jenkins.getInstance().getRootUrl() + "/plugin/gitlab-jenkins/images/unknown.png");
rsp.sendRedirect2(baseUrl + "/plugin/gitlab-plugin/images/unknown.png");
}else if(currentBallColor == BallColor.RED) {
rsp.sendRedirect2(Jenkins.getInstance().getRootUrl() + "/plugin/gitlab-jenkins/images/failed.png");
rsp.sendRedirect2(baseUrl + "/plugin/gitlab-plugin/images/failed.png");
}else if(currentBallColor == BallColor.YELLOW) {
rsp.sendRedirect2(Jenkins.getInstance().getRootUrl() + "/plugin/gitlab-jenkins/images/unknown.png");
rsp.sendRedirect2(baseUrl + "/plugin/gitlab-plugin/images/unknown.png");
} else {
rsp.sendRedirect2(Jenkins.getInstance().getRootUrl() + "/plugin/gitlab-jenkins/images/unknown.png");
rsp.sendRedirect2(baseUrl + "/plugin/gitlab-plugin/images/unknown.png");
}
}