Can I trigger Team City build from Windows Command Line? - windows

I have setup a Teamcity Project in Windows system within Teamcity.
But I wish to trigger the Teamcity build from Windows command prompt.
Is this possible?
If yes, Is there any documentation or setup guide for this?

Taken from the TeamCity documentation:
curl -v -u user:password http://teamcity.server.url:8111/app/rest/buildQueue --request POST --header "Content-Type:application/xml" --data-binary #build.xml
https://confluence.jetbrains.com/display/TCD9/REST+API#RESTAPI-TriggeringaBuild

Related

Bitbucket Tagging for every bitbucket commit

Need help for creating tag for every bit bucket commit.
Please let me know if anyone have implemented this using Jenkins pipeline, if yes how can we achieve that
I'm going to assume you have some sort of Multi-branch pipeline job set up, or some mechanism to trigger a jenkins job for each commit to BitBucket. Bitbucket will need to trigger a Jenkins job for each commit via a webhook
In your pipeline code, you'll need to do the following:
Get the hash of your commit. You can get this data from the GIT_COMMIT variable in the Git Jenkins Plugin
Create a Bitbucket tag via their api with the commit hash mentioned above
curl https://api.bitbucket.org/2.0/repositories/jdoe/myrepo/refs/tags \
-s -u jdoe -X POST -H "Content-Type: application/json" \
-d '{
"name" : "new-tag-name",
"target" : {
"hash" : "a1b2c3d4e5f6",
}
}'
There are few different ways to do #2.
Put that code in a powershell script and run it from your job.
Call it directly from your jenkins pipeline like this stackoverflow answer.
Or if you plan to do this from many jobs, you could also create your own Bitbucket Api Client shared library that does the api interaction for you.
Note: You'll likely need to authenticate these Bitbucket api requests
I was able to get rid of error using env.GIT_COMMIT

Perform Maven Release with dry-run checkbox from jenkins

Need to Trigger "Perform Maven Release" of other job by using command smthing like this
curl 'https://192.10.160.105/jenkins/view/job/mavwn/m2release/'
-H 'Content-Type: application/x-www-form-urlencoded'
--data 'releaseVersion=$releaseVersion&developmentVersion=$developmentVersion&json={ releaseVersion: $releaseVersion, developmentVersion: $developmentVersion}&Submit=Schedule+Maven+Release+Build'
mentioned in
"https://medium.com/#fercalderon/how-to-trigger-a-maven-release-job-from-a-pipeline-job-in-jenkins-6449cf2e6263"
But in the maven Jenkins job there is dry-run checkbox to select, How to select dry-box through given command and schedule a build? Please share if any one has any idea?. Thanks in advance
you can do like this to select a checkbox when triggering the build
&name=dry-box&value=on
curl 'https://192.10.160.105/jenkins/view/job/mavwn/m2release/'
-H 'Content-Type: application/x-www-form-urlencoded'
--data 'releaseVersion=$releaseVersion&developmentVersion=$developmentVersion&name=dry-box&value=on&json={ releaseVersion: $releaseVersion, developmentVersion: $developmentVersion}&Submit=Schedule+Maven+Release+Build'

Toggle heroku maintenance mode without CLI or Web UI

I'm using Jenkins to run tests before deploying to Heroku using a git publisher plugin. I want to sandwich my deploy with maintenance mode ON/OFF but don't want to install the heroku toolbelt (reference) on my jenkins machine (nor do I want to go to the Web UI and toggle the maintenance mode manually). I don't want to install the heroku toolbelt on jenkins because it adds to the customization and configuration I'd need to do to the jenkins installation and I want to keep my jenkins instance as disposable as possible...driven rather by source code pipelines (Jenkinsfile).
Ideas:
utilize a docker image that has the heroku toolbelt installed on it
utilize a multi-buildpack that does it for me?
Any suggestions or experience on how I might accomplish this?
You can use heroku's platform api to do this:
https://devcenter.heroku.com/articles/platform-api-reference#app-update
The following curl request will put your app into maintenance mode:
curl -n -X PATCH https://api.heroku.com/apps/$APP_ID_OR_NAME \
-d '{"maintenance": true}' \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.heroku+json; version=3"
-H "Authorization: Bearer <heroku token>
You will just need to replace the app name, as well as the token.
You can generate OAuth tokens using the cli-oauth cli plugin locally.

Setting namespace of a GitLab repository

This is my Ruby script for GitLab API, I'm doing commits and pushes with it: https://github.com/ivanove/my_works/blob/master/Create-Repo.rb
I'm using CURL inside of it to make requests.
So the question is, how can I set namespace of repository when it's created?
This is the command I use:
cmd = %Q<curl -H "Content-Type:application/json" http://#{#host}/api/v3/projects?private_token=#{#token} -d '{"name":"#{name}","visibility_level":20,"namespace_id":"group-from-1"}'>
I added namespace_id from GitLab Documentation, but it doesn't work.

Parse Cloud Code Deploy

I am currently setting up Parse Cloud Code and I have gotten to the final step which is to deploy the main.js file but when I do this it just opens the file in Adobe Dreamweaver?
I was having problems understanding how to deploy the main.js file.
Read the following steps: https://www.parse.com/apps/quickstart#cloud_code/unix
It contains:
Get the Parse tool
Download the command line tool by running this command:
curl -s https://www.parse.com/downloads/cloud_code/installer.sh | sudo /bin/bash
This installs a tool named parse to /usr/local/bin/parse. That is the only thing that's added, so to uninstall, just delete that file. Running this command will also update your existing Parse command line tool if you already have it installed.
Set up a Cloud Code directory
Open a new terminal window, run the command parse new and follow the instructions.
$ parse new
Please login to Parse using your email and password.
Email: ninja#gmail.com
Password (will be hidden):
Would you like to create a new app, or add Cloud Code to an existing app?
Type "new" or "existing": existing
1:MyApp
2:MyOtherApp
Select an App to add to config: 1
Awesome! Now it's time to setup some Cloud Code for the app: "MyApp",
Next we will create a directory to hold your Cloud Code.
Please enter the name to use for this directory, or hit ENTER to use
"MyApp" as the directory name.
Directory Name: MyCloudCode
Your Cloud Code has been created at ${CLOUD_CODE_DIR}.
Next, you might want to deploy this code with
"parse deploy"
.
This includes a "Hello world" cloud function, so once you deploy
you can test that it works, with:
curl -X POST \
-H "X-Parse-Application-Id: ${APP_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{}' \
https://api.parse.com/1/functions/hello
$ cd MyCloudCode
Go to the directory where your Main.js file does exist and
use command $parse deploy to deploy your code on parse cloud.Refer this link if you are using Linux system.https://www.parse.com/apps/quickstart#cloud_code/unix and use this link if you are using windows system https://parse.com/apps/quickstart#cloud_code/windows.
Hope it will help.
As far as I understand from your question, you want to deploy the main.js file to the Parse cloud. The problem that you face opening in Adobe Dreamweaver is related with your computer where you configure the file open with the Adobe Dreamweaver.
The answer to your question is; as detailed in Parse Cloud tutorial, first you have to install Parse command line tool. This tool enables you to manage your code in Parse cloud. Then you can use "parse new" command to set up a cloud directory where you have to replace the main.js file with your own. Following that "parse deploy" will deploy your js file to the Parse cloud. You can find detailed information in tutorials Parse Cloud. Hope this helps.
Regards.

Resources