How to get parameters from CMD for Behat? - bdd

I am testing new features in the new project branch, which has a new URL. I need to dynamically change the base url for Behat tests. How can I do it?

The right way of doing that would be to change the base_url in your behat.yml configuration. It's a new branch, it has new features, there's no reason why you can't or shouldn't change the test configuration for it. When you merge it with the master, you simply leave the config out of merge or change the base_url back.
If you want to do it via the command line still, see this question for details. This might not override the original value if you do have a config though, I've never tested this.
BEHAT_PARAMS="context[parameters][base_url]=http://google.fr" bin/behat

Related

Skylark - can a rule access the attributes of another rule from its label?

This question piggybacks this github issue. However, I have ran into this issue in one other context.
Context
Within Bazel, there are two repository rules, maven_jar and maven_server.
maven_jar(name, artifact, repository, server, sha1)
maven_server(name, repository, settings)
The maven_jar rule's server attribute is a label pointing to some maven_server target.
Currently, whenever the server attribute is provided, the maven_jar rule errors out.
What I would like to accomplish
Within maven_jar's implementation function, I would like to access the maven_server's attributes. Specifically, I would like to do something along the lines of:
def _impl(rtx):
settings_attr = rtx.attr.server.getSettings()
# alternatively
settings_attr = rtx.attr.server.getAttributes().settings
Is this behavior supported? If not, any way I can approximate it?
The server attribute is a label, so I'm not sure if one can obtain these values using its providers/aspects.
Repository rules are macros, so they do not have providers the same way "normal" rules do. Thus, if you specify a label attribute, it basically has to be a source file.
As settings.xml isn't supposed to be project-specific, I think it mgiht make more sense for maven_jar to use the users/system's settings.xml, as described in the Maven docs:
There are two locations where a settings.xml file may live:
The Maven install: ${maven.home}/conf/settings.xml
A user’s install: ${user.home}/.m2/settings.xml
The former settings.xml are also called
global settings, the latter settings.xml are referred to as user
settings. If both files exists, their contents gets merged, with the
user-specific settings.xml being dominant.

Are there any jenkins plugins for choice parameters that amend themselves after a new entry?

Are there any jenkins plugins for choice parameters that amend themselves after a new entry if the build succeeds?
Basically, something like this:
-Choice Parameter-
Name: All_Choices_So_Far
Choices:
First_Default_Choice
${New_Choice}
So when someone picks ${New_Choice} and fills out the New_Choice field, whatever goes there then does the following, conceptually, not syntactically, as I don't know what the actual syntax would be:
Build Succeeded? If so then,
All_Choices_So_Far.Choices.add(${New_Choice})
All_Choices_So_Far.Choices = All_Choices_So_Far.Choices.uniq
Apply & Save Config
I don't actually care about the workflow being that specific, but that's roughly the functionality that I'm looking for.
Although I've yet to make a Jenkins plugin myself, if this doesn't already exist, I would be interested in how to pursue it.

Change Jira Base URL

Is there a way to change the Base URL of a Jira instance.
JIRA 7.0.5
I remember it asked me when I started it up initially, but I can seem to find a way to change it.
Copy title of question and first google result: https://confluence.atlassian.com/doc/configuring-the-server-base-url-148592.html
Choose the cog icon , then choose General Configuration under Confluence Administration
Choose General Configuration in the left-hand panel
Choose Edit Enter the new URL in the Server Base URL text box
Choose Save
Changing the context path. If you change the context path of your base URL, you may also need to edit the web server's server.xmlfile to reflect the new path:
Stop the Confluence server.
Go to your Confluence 'destination directory'. This is the directory where the Confluence installation files are stored. For example, C:\Program Files\Atlassian\Confluence. Let's call this directory '{CONFLUENCE_INSTALLATION}'.
Edit the configuration file at {CONFLUENCE_INSTALLATION}\conf\server.xml.
Change the value of the path attribute in the Context element to reflect the context path. For example, if Confluence is running at http://www.foobar.com/confluence, then your path attribute should look like this:
<context path="/confluence" docBase="../confluence" debug="0" reloadable'"false" useHttpOnly="true">
Save the file.
Proxies. If you are running behind a proxy, ensure that the proxy name matches the base URL. For example: proxyName="foobar.com" proxyPort="443" scheme="https". This will make sure we are passing the information correctly.
This information needs to be added in the Connector element at {CONFLUENCE_INSTALLATION}\conf\server.xml.
Go to Admin->System->General Configuration
Click Edit Settings
Change Base URL and click Save
You can retrieve the base URL from the propertystring table:
select propertyvalue from propertyentry PE
join propertystring PS on PE.id=PS.id
where PE.property_key = 'jira.baseurl';
In order to update the Base URL, run the following update query in your JIRA database replacing the URL and restart JIRA.
update propertystring
set propertyvalue = 'http://jira.servername.com'
from propertyentry PE
where PE.id=propertystring.id
and PE.property_key = 'jira.baseurl';
more info follow this link
Crackerjoe is correct.
The suggestion given to do it with SQL is very bad advice. Using SQL on JIRA databases is to be avoided, especially when you can, and should, do it in the UI. If you do use SQL, make sure you have JIRA offline before you do it.

In Jenkins can I use a parameter value in other config fields?

I am setting up a parameterized build on my Jenkins server.
Basically I want to have the git branch name as a parameter. Then I want to use that parameter in various other fields in the job config.
I don't know if this is even possible, but I hope that it might be as it seems an obvious need.
The only docs I could find is this old wiki page
https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build
It shows that build parameter is available as an ENV var, but it doesn't show how to use it elsewhere in the job config.
despite being undocumented, this syntax works in job config fields
${PARAM_NAME}
Just use $PARAM_NAME anywhere in the configure.
The easiest way is to use the "Git parameter" parameter type in your config and then you can reference that simply in the Source Code Management section - see here. This assumes that the Jenkins instance has the Git parameter plugin installed.
If you don't have that option, then:
you can simply add a String parameter to the configuration and use that in you configuration, but you need to uncheck "Lightweight checkout" to avoid errors like this:
stderr: fatal: Couldn't find remote ref refs/heads/${BRANCH}
String parameter declaration:
String parameter usage:
Source of pictures

How to add a set path only for that batch file executing?

Basically, I know I can go through my control panel and modify the path variable. But, I'm wondering if there is a way to through batch programming have a temporary path included? That way it is only used during that batch file execution. I don't want to have people go in and modify their path variables just to use my batch file.
Just like any other environment variable, with SET:
SET PATH=%PATH%;c:\whatever\else
If you want to have a little safety check built in first, check to see if the new path exists first:
IF EXIST c:\whatever\else SET PATH=%PATH%;c:\whatever\else
If you want that to be local to that batch file, use setlocal:
setlocal
set PATH=...
set OTHERTHING=...
#REM Rest of your script
Read the docs carefully for setlocal/endlocal , and have a look at the other references on that site - Functions is pretty interesting too and the syntax is tricky.
The Syntax page should get you started with the basics.
There is an important detail:
set PATH="C:\linutils;C:\wingit\bin;%PATH%"
does not work, while
set PATH=C:\linutils;C:\wingit\bin;%PATH%
works. The difference is the quotes!
UPD also see the comment by venimus
That's right, but it doesn't change it permanently, but just for current command prompt.
If you wanna to change it permanently you have to use for example this:
setx ENV_VAR_NAME "DESIRED_PATH" /m
This will change it permanently and yes, you can overwrite it in another batch script.

Resources