Enable avatars in Gerrit 2.14 - gerrit

I have installed external avatar plugin for Gerrit.
gerrit.config:
[avatar]
url = https://outlook.office.com/owa/service.svc/s/GetPersonaPhoto?email=%s
Is there a way to replace %s for email? Because %s is taking username by default.

Are you using the avatars/external plugin? This plugin was deprecated and replaced by the avatars-external plugin. In the new plugin you can use something like this:
url = http://example.org/avatars/${user}.jpg
See more info here
You could try to use ${user} or maybe it's time to update your plugin.

Related

how to get fixed static images url for jenkins?

I generated the html webpage in jenkins jobs and try to success/failure icons inside.
But I noticed it is linked to the url with some random number 9b17c509 in the path
https://ci.jenkins.io/static/9b17c509/images/32x32/red.png
What I preferred is the fixed url for every jenkins instance like
https://ci.jenkins.io/static/images/32x32/blue.png
Any suggestion to solve it ?
BTW: I don't want to connect to external web for those images
9b17c509 looks like a cache.
We can use /images/32x32/blue.png
see https://ci.jenkins.io/images/32x32/blue.png
For a hudson.model.Result or the result name like "SUCCESS" you can get a ball icon with hudson.model.BallColor .
In Groovy
def iconUrl = (result as BallColor).getImageOf("16x16")

Jenkins: add some text to the build summary

For each build in jenkins there's a page with a short summary of what happened in that build.
In my setup this page contains the list of commit messages that were added in this build, the name of the user who started that build and a note from the git plugin about the commit SHA1 and the branch name.
Is there a way for a normal script that I run as a build step to add something to this page? Is there a plugin which allows this?
I want to add a line with an HTML link to where the user can download this build.
You can use the Description Setter plugin to add a custom HTML description.
A quick example :)
Does it help?
UPDATE: here is the syntax for a Jenkins pipeline script
currentBuild.description = "<a href='http://stackoverflow.com'>Stackoverbuild build" + env.BUILD_ID + "</a>"
I used Badge Plugin for something like this.
Example:
def summary1 = createSummary(icon:"notepad.png", text:"started Builds:<br>")
summary1.appendText("myBuild1: SUCCESS<br>", false)
summary1.appendText("myBuild2: UNSTABLE<br>", false)

jasmine-reporters not working with grunt-protractor-runner?

i use the grunt-protractor-runner to run my protractor tests with jenkins. Now jenkins needs the xml output to inform me about the test run.
I have installed jasmine-reporters. I have read all other topics and i am sure the installation is correct but i do not receive any output files from it...
Could you please help me?
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('configurations/protractor/xmloutput', true, true));
i have installed jasmine-reporters version 1.0.1
I have a similar setup using grunt-protractor-runner, but I don't generate an XML for Jenkins. You could use the protractor-html-screenshot-reporter
This will generate an html report. I then configured Jenkins to publish the HTML report using the HTML Reporter plugin which gives a tidy link on the page and displays the results in a tabular format.
The conf.js needs the following two snippets
var HtmlReporter = require('protractor-html-screenshot-reporter');
var path = require('path');
and
onPrepare: function() {
var directory = __dirname;
browser.baseUrl = process.argv[3];
htmlFilePath = directory + '\\reports\\';
// Add a screenshot reporter and store screenshots:
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: directory + '\\reports',
preserveDirectory: true
}));
}
This is a very late answer. I post it just in case someone run into this and somehow get link to this question. In our case, we are trying to use teamcity reporter instead of XML reporter. The problem may be caused by your protractor is running with Jasmine 1.X while your jasmine-reporters' version is 2.X. Try to downgrade jasmine reporter to 1.1.0 may solve your problem.

How build Vaadin project with gradle?

I have gradle project (backend) and I want to add Vaadin-based frontend. But I haven't find any gradle-plugins for Vaadin.
While, as was already mentioned above, Vaadin app is a simple web application and does not require any additional plugins but "java" and "war" (and maybe "jetty" to run the app), currently there seems to be the first vaadin-specific gradle plugin available:
https://github.com/johndevs/gradle-vaadin-plugin
It will help you with Vaadin-specific task like building widgetsets, creating components skeletons, etc.
I think there is no a Vaadin plugin for Gradle but I have used Gradle in one of my Vaadin add-on projects: SplitButton. It's a project with sub-projects, widgetset compilation and it writes necessary jar manifest entries neebed by Vaadin Directory.
EDIT
Actually there is Gradle Vaadin plugin now - it allows you to easily build Vaadin projects with Gradle. It helps with the most tedious tasks when building a Vaadin project like building the widgetset and running development mode. It also helps you to quickly get started by providing tasks for project, component and theme creation:
https://github.com/johndevs/gradle-vaadin-plugin
You don't need a Vaadin plugin. A Vaadin application is simply a web application.The war plugin will suffice. If you want support for automatically creating the folder layout that Vaadin wants however, you might look into using the vaadin eclipse plugin found here:
http://vaadin.com/eclipse
If you are looking for deployment support, you can simply use the jetty plugin that comes with gradle or the tomcat plugin found here
https://github.com/bmuschko/gradle-tomcat-plugin
If you need to create custom widgets and compile them into a widgetset that's a GWT compile
https://vaadin.com/book/vaadin6/-/page/gwt.development.html#gwt.development.compiler
Note: The Vaadin7 Book no longer has the section on developing Gwt widgets.
There is a gradle plugin for GWT that could help with that. However, I've not needed a custom widget yet, so I haven't actually tried it.
https://github.com/markuskobler/gwt-gradle-plugin
This post:
Using Gradle with Vaadin
looks very comprehensive as far as Gradle+Vaadin setup goes. I'm also including a link to another Vaadin-based 'build.gradle' file I found on my travels, using Google's very useful 'filetype' search (see also the associated gradle.properties file).
JFYI that Google file search is:
filetype:<extension> <your search phrases>
Gradle can also be used to configure Eclipse and IntelliJ's project files by using a fragment such as the following (Eclipse natures can be 'found' by using the above Google file search for "project" extension and "natures" search, etc.):
//Template plugin - Great for project-layout setup - See http://tellurianring.com/wiki/gradle/templates
apply from: 'http://launchpad.net/gradle-templates/trunk/latest/+download/apply.groovy'
apply plugin: 'eclipse'
apply plugin: 'idea'
// if you want to distribute the gradle with your code
task('wrapper', type: Wrapper).configure {
gradleVersion = '1.0-milestone-8a'
}
def versionCompatibility = 1.6
//configurations.providedDependencies.extendsFrom configurations.gwt
eclipse {
project {
comment = ""
buildCommand "org.eclipse.jdt.core.javabuilder"
buildCommand "org.eclipse.wst.jsdt.core.javascriptValidator"
buildCommand "org.eclipse.wst.common.project.facet.core.builder"
buildCommand "org.eclipse.wst.validation.validationbuilder"
buildCommand "com.vaadin.integration.eclipse.widgetsetBuilder"
//buildCommand "org.eclipse.m2e.core.maven2Builder"
//buildCommand "org.maven.ide.eclipse.maven2Builder"
//buildCommand "com.google.gdt.eclipse.core.webAppProjectValidator"
//buildCommand "com.google.gwt.eclipse.core.gwtProjectValidator"
//buildCommand "com.google.gdt.eclipse.designer.GWTBuilder"
//Don't forget commas - no trailing
natures "org.eclipse.jdt.core.javanature",
"com.vaadin.integration.eclipse.widgetsetNature",
"org.eclipse.wst.jsdt.core.jsNature",
"org.eclipse.wst.common.project.facet.core.nature",
"org.eclipse.wst.common.modulecore.ModuleCoreNature",
"org.eclipse.jem.workbench.JavaEMFNature"
//"org.eclipse.m2e.core.maven2Nature",
//"org.maven.ide.eclipse.maven2Nature",
//"com.google.gwt.eclipse.core.gwtNature"
//"com.google.gdt.eclipse.designer.GWTNature",
//"ch.epfl.lamp.sdt.core.scalanature",
//"com.springsource.sts.grails.core.nature",
//"org.eclipse.jdt.groovy.core.groovyNature"
}
classpath {
containers "com.google.gwt.eclipse.core.GWT_CONTAINER"
//"com.springsource.sts.gradle.classpathcontainer"
//minusConfigurations=[configurations.gwt]
}
}
idea {
project {
jdkName = versionCompatibility
ipr {
withXml { provider ->
def node = provider.asNode()
// Set Gradle home
def gradleSettings = node.appendNode('component', [name: 'GradleSettings'])
gradleSettings.appendNode('option', [name: 'SDK_HOME', value: gradle.gradleHomeDir])
}
}
}
}
Cheers
Rich

In Grails, how can I append a build number when using 'set-version'

I am using Jenkins (Hudson) with the Grails plugin to do builds as I update svn. I found this example script that allows you to incorporate a build number from an env var:
set-version 1.1.0.${env['BUILD_NUMBER']}
But as you see, the prefix is hard-coded. I'd like to use the version number set in the application.properties file. How can I do something like:
set-version ${app.version}.${env['BUILD_NUMBER']}
Have tried a variety of scopes/syntax to no avail.
It is not possible out of the box. Jenkins or specifically the Grails plugin does not read the content of the application.properties file and hence the existing application version is not available as a variable.
You might want to consider writing a custom script in your application (like append-version) that will read application.properties and append the value passed in. You can call the existing set-version script modifying the argument.
I have also created a simple script that should do the job:
includeTargets << grailsScript("Init")
target(main: "Append a string to the existing version number") {
depends(checkVersion, parseArguments)
def newVersion = metadata.'app.version' + '-' + args
metadata.'app.version' = newVersion
metadata.persist()
}
setDefaultTarget(main)

Resources