Docker Hub Remtoe Build Triggers - docker

https://docs.docker.com/docker-hub/builds/#remote-build-triggers
Docker hub now has a build system in place. One of the ways to trigger a container to be built is using Remote build triggers. COmmands such as the following:
$ curl --data build=true -X POST https://registry.hub.docker.com/u/svendowideit/testhook/trigger/be579c82-7c0e-11e4-81c4-0242ac110020/
Their website shows a few paramters that can be passed in. But does not explain their meaning, nor do they provide a list all possible parameters.
What are all the possible parameters and what are their meanings?

it works for branches for sure, not sure about tags:
curl -H "Content-Type: application/json" \
--data '{"source_type": "Branch", "source_name": "develop"}' \
-X POST "$DOCKERHUB_TRIGGER";
Try source_type = Tag

Related

Jenkins : Pass mixed parameters to Jenkins API

Current Jenkins parameter looks like below and <input_paramter> are the actual values to be substituted over there.
I have an idea on how to pass string parameters or json parameters separately but unsure how to handle them both simultaneously.
Referred Jenkins documentation as well as multiple questions posted on this forum, but could not figure that out.
curl -X POST https://myjenkins.instance/build \
-H 'Content-Type: application/json' \
--user user:token \
FILE_PATH="/home/mac/results" \
PACKAGE_VERSION=64 \
<how to handle the json parameters>

Trigger Jenkins build via curl with additional parameter

I'm trying to trigger the Jenkins build via curl command with additional parameter as described in the following image:
I'm using --data-urlencode json='{"parameter": [{"name":"text", "value":"develop:test"}]}' but it doesn't work.
curl -X POST --user "${userName}:${password}" -H "Jenkins-Crumb:33c13aed5548ad43bf5e2eb276cf21af" "JENKINS_URL/job/JOB_NAME/buildWithParameters" --data-urlencode json='{"parameter": [{"name":"text", "value":"develop:test"}]}'
JenKins still build with the default parameter instead:
Any solution? Thanks.

how to post a json file using curl in docker file for the container

I have created a baseDocker https://github.com/streamsets/datacollector-docker image .
Now as per entry-point it restarts the stream sets data collector.
So, now I have created another child dockerfile based on this above base image where I have copied lots of pipeline related libs(this is not the issue). Now at the end of this child dockerfile, I have to post a pipeline using curl. In this child dockerfile, I have copied the pipeline to /tmp folder.
my question is how to post a json pipeline using CURL in the child dockerfile. Knowing that streamsets has been running from the base.
so, my shell script looks like this
curl --noproxy localhost:18631 --insecure --silent --request POST http://localhost:18631/rest/v1/pipeline/test/import" --user xxx:xxxx --data-binary #/tmp/pipeline.json" --header "Content-Type: application/json" --header "X-Requested-By:sdc" --write-out "%{http_code}" --output /tmp/sdc-pipeline-response.json

Trigger jenkins job with parameters from shell

I am trying to trigger a trigger jenkins job from shell but as of now no sucess.I tried both these methods
curl -u ceadmin:ceadmin -X POST http://abc-lnx:8080/job/ci_demo/build --data token=ci_build -data-urlencode json='{"parameter": [{"name":"Branch", "value":"master"}, {"name":"verbosity", "value":"high"}]}'
curl -X POST http://abc-lnx:8080/job/ci_demo/buildWithParameters?token=ci_build&Branch=master
I have defined ce_admin as token in my job. also ce_admin is a admin user in Jenkins.Anonymous user do not have any permission other then read on jobs and views.
What am i missing?
This works for me:
#parameters:
username=user
password=password
jenkins_url=example.com/build
some_token=hi
job_name=dostuff
curl -u $username:$password -X POST https://$jenkins_url/job/$job_name/build\?token\=$some_token
So this should work for your example (I escaped "?", and "&"):
curl -u ceadmin:ceadmin -X POST http://abc-lnx:8080/job/ci_demo/buildWithParameters\?token=ci_build\&Branch=master

Deis docker image deploy

Trying to deploy the go-example app from the documentation :
http://docs.deis.io/en/latest/using_deis/using-docker-images/#using-docker-images
I am skipping the "Prepare the application" bit and trying to deploy the example docker app gabrtv/example-go
I run the following to do the deployment :
deis pull gabrtv/example-go:latest
Does not work I get the following :
"GET Image Error (404: {\"error\": \"Tag not found\"})"
Looking at
https://registry.hub.docker.com/u/gabrtv/example-go/tags/manage/
The latest tag is there.
Pulling it with
docker pull gabrtv/example-go
it get's pulled correctly. So I am not really sure what I am doing wrong.
Using the controller API with curl gives me the same result :
curl -i -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d '{"image":"gabrtv/example-go"}' \
http://$IP:$PORT/v1/apps/dummyapp2/builds/
Anyone have any idea?
Are you also skipping the section 'Create an Application'? In Deis an application is a group of container being load balanced to by the routing layer. In the example they have you create a folder named 'example-go', cd into it, and then run 'deis create'. This defaults to the current folders name for the application name. Instead you can run:
deis create example-go
Then you can run the deis pull command with the '-a' flag telling it which application to to associate the container with.
deis pull gabrtv/example-go:latest -a example-go

Resources