Can I get some help on promoting a build using REST API with cURL command.
I have been successful in updating the status using the below syntax:
curl -X POST -u admin:password -H "Content-Type: application/json" -d '{"status":"tests passed","ciUser":"jenkinsAdmin"}' "http://localhost:8081/artifactory/api/build/promote/buildName/buildNumber"
But, unable to move the build from one repository to another. My aim to, promote the build from one repository to another when I run the cURL command with parameters. So that my build is moved to other repository and the status gets updated too.
I also get the below message when I run the curl command:
{"level":"INFO","message":"Skipping build item relocation: no target repository selected."}
This post relates to the question about changing existing build status in artifactory
Please Advice.
As described in the documentation, you just need to set the targetRepo parameter. Please note the snapshot-release handling policy in the target repository.
See if this script can help.
https://github.com/JFrogDev/artifactory-user-plugins/blob/8a06563d853995ea7f59f0f5f3a67bcb08b5c2e9/build/promotion/promotion.groovy
PS: Every team / company have different requirements, rules/policies on what to promote (artifacts), how to promote (steps) and what checks/rules/conditions/policies that I should make sure are true/false or set/passed before doing any promotion step; so change this code according to your needs.
Also check these: https://www.jfrog.com/confluence/display/RTF/Working+With+Pipeline+Jobs+in+Jenkins#WorkingWithPipelineJobsinJenkins-PromotingBuildsinArtifactory on how you can do the same within Jenkins and for fun, look here: Delete jenkins builds during Promote / promotion step if you want to do some maintenance in Jenkins or in Artifactory.
Related
I have started to use version control in RStudio using GitLab, but now I wish to use GitHub instead. So, I need to move all of my repositories from GitLab to GitHub, as specified e.g. here.
But, for some time, I was using both GitHub and GitLab simulteneously, and developing single project on both repos individually! Quite stupid, but it happens..
Shortly, now I need know, which repo (GitHub or GitLab) is my R studio using? I am looking for some code that will print out the http of the repository in use?
something like repo.print and will return the http associated: https://gitlab.com/xx/yy/z or https://github.com/xx/yy/z.
git config --get remote.origin.url in Terminal or
shell("git config --get remote.origin.url")
in R console / script.
I am trying to get docfx to generate a doc website based off of a C# library and I can't seem to get any of the commands covered in the documentation to work.
On the quickstart page it states to use the following command to initialize a template docfx init -q however when I run this command I get the following error message:
'init' was not matched. Did you mean 'new'?
'-q' was not matched. Did you mean '-h'?
Required command was not provided.
Unrecognized command or argument 'init'
Unrecognized command or argument '-q'
Usage:
docfx [options] [command]
Options:
--version Show version information
-?, -h, --help Show help and usage information
Commands:
new <templateName> Creates a new docset.
restore <directory> Restores dependencies before build.
build <directory> Builds a docset.
serve <directory> Serves content in a docset.
The documentation (as far as I can tell) doesn't cover the options displayed by the tools output. I have checked a number of times now to make sure I am not going insane but I definitely downloaded the package from the page listed on the quickstart page.
Does anyone regularly use Docfx and can tell me how to go about generating the html for my library?
Looks like you're using 3.x, which is undocumented.
You can download 2.59.2 here
I'm trying to serve a stock jenkins installation (on Amazon Linux AMI) thru myjenkinsinstance:8080/jenkins (rather than myjenkinsinstance:8080), and then proxy this with e.g. Nginx (over HTTP).
This question has been 'answered' before, but the solution doesn't seem to be relevant anymore.
#admins I would prefer to comment on that thread (specifically this 'answer'), rather than opening a duplicate, but I am not allowed to, per my 'reputation' score (as my comment would not be a solution at all, but further request for help).
From the closest thing to an answer I've seen:
Go to Jenkins Home Directory ( I have mine in C:\Jenkins)
Edit jenkins.xml
Add this --prefix=/jenkins to the end of the argument as show below and restart the jenkins service ALL worked OK for me !
Example : <arguments>-Xrs-Xmx256mDhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --prefix=/jenkins</arguments>
Open Url http://localhost:8080/jenkins this should bring up the home page of jenkins
there is no 'jenkins.xml' in the $JENKINS_HOME directory, but there is a config.xml
there is no <arguments/> entry in the config.xml
there seems to be no other configuration for the initial installation
There's also a 'Jenkins Location > Jenkins URL' setting in the "Configure System" settings (myjenkinsinstance/configure), but modifying this seems to have no noticeable affect.
The end goal would be to automate this installation via e.g. CloudFormation (as part of the EC2's UserData).
Any suggestions would be greatly appreciated.
On your linux system, you need to find the jenkins default config file located at
/etc/default/jenkins
and then add the following arguments according to your requirements. This is a rough idea.
JENKINS_ARGS="--webroot=/var/cache/jenkins/war --prefix=/jenkins
--httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT"
This should work most likely. If it doesnt, pls update your answer with the current arguments present. This works fine for Debian/Ubuntu.
Also you are running jenkins on your windows machine or linux?
So my 'solution' was to use sed and insert some lines into /etc/nginx/nginx.conf and /etc/init.d/jenkins.
e.g.
sed -i '/^ location \/ {/aproxy_pass http://127.0.0.1:8080/;' /etc/nginx/nginx.conf
sed -i '/^PARAMS=/ s/"$/ --prefix=\/jenkins"/' /etc/init.d/jenkins
I highly doubt this is anything near a 'best practice', but it seems to work for now (what happens were I to update with yum... I'm not sure, but the plan is to back the instance with an Elastic Filesystem, which hopefully will allow us to consider the jenkins instance ephemeral, anyway).
When attempting to push to GitHub from RStudio, I get the following errors.
error: unable to read askpass response from 'rpostback-askpass'
fatal: could not read Username for 'https://github.com':
No such device or address
RStudio has my origin as
https://github.com/rmscriven/other.git
when it actually should be
https://github.com/rmscriven/saber.git
RStudio will not allow me to change the origin from the version control system. Here is what it shows:
Is it possible to change my GitHub origin url from RStudio?
Thanks to the pro tip provided by #krlmlr in the comments,
Use an empty target directory. Look for "clone URL" on your GitHub project page, perhaps choose the SSH variant.
I clicked "clone url" on GitHub once, nothing. Then again, nothing. And once again for good measure, nothing. So I went to the terminal, read the man git help file, and decided to change my password and reconfigure. These are the lines I ran, and it was successful.
git config --global user.name <myuser.name>
git config --global user.email <myuser.email>
git clone https://github.com/rmscriven/saber.git
git pull
Then I went to RStudio and it allowed me to clone my repository, and change the URL of my version control setting. Here's a colorful pic
New project -> Version Control -> Git -> Create Project
Next, magic happened, and I had a copy of my package which I very carefully removed to prepare to push the development tarball to GitHub. Rock on.
#krlmlr, I thank you for nudging me in the right direction. Now I feel like I'm actually doing it the right way. :)
And for fun, try saying 'rpostback-askpass' ten times fast.
I had the same problem and for me these two simple steps worked great:
Add the SSH key from RStudio to my github account.
Change the origin URL and use the -u flag for push/pull once (solution found here).
For 1., in RStudio go to Tools → Global Options... → Git/SVN → view public key, and copy the key. In your browser of choice, logged in on Github, click Edit Profile → SSH keys and paste the copied key here.
For 2., back in RStudio, click Tools → Shell… , then enter:
git remote add origin https://github.com/myname/test.git
git config remote.origin.url git#github.com:myname/test.git
git pull -u origin master
git push -u origin master
Of course, change "myname" to your username and "test.git" to the name of your project. (Or even "github.com" to the URL of your institute's github or similar.)
After doing this once, the Push/Pull buttons in RStudio should work and you don't need the shell anymore!
I've been running into this issue on multiple computers now, with a remote that doesn't support SSH and thus can't leverage password-less login.
The problem in this case is that by default, git ask for the password interactively, and RStudio can't display this graphically. The trick is to use git's credential storage system.
For instance on Mac OS X:
git config --global credential.helper osxkeychain
On Linux one could use the gnome-keyring integration.
From the libcurl documentation, I understand NOSIGNAL has to be set to 1 when using multi-thread program.
However, if I am calling curl from a command line, I don't see a NOSIGNAL switch/option. How do I set nosignal when calling curl directly?
You can't: as you said, there is no such option documented by cURL help (and you can also verify that there is no reference to CURLOPT_NOSIGNAL within the command-line source code - see src/tool_operate.c).
Now the question is why you would need this, as asked by Celada. Using libcurl in a multi-threaded context makes sense (i.e. you may want to create/reuse curl handles from several threads) - and you should then follow the best practices, but I don't see the point with the CLI tool.