-
Notifications
You must be signed in to change notification settings - Fork 1
Home
anyei edited this page Aug 26, 2015
·
2 revisions
We are assuming you have installed the docker image anyei/jenkins-to-salesforce.
- Go to your jenkins server, like this http://yourjenkinsserver:8080
- Click on the job you want to configure git. If you dont have any, you may click on "New Item" link from the top left corner and then select the option "Freestyle project", of course you to type in a title for the job.
- Click on "Configure" link from the left menu.
- Go to the "Source Code Management" section and select "git" option.
- In the Repository Url input, provide the source git repository, it should be something like this one git@github.com:anyei/jenkins-to-salesforce.git.
- After putting the focus out of the input text, it will try to validate that repo, an error message may appear next to the input box for many reasons, we just ignore for now and keep moving.
- Click the "Add" button from the "Credentials" field which will open the add credentials popup window.
- In the add credentials popup window, select "SSH Username with private key" in the Kind field.
- Leave Scope field as it is, and type in "jenkins" in the Username field.
- In the private Key field, you may select "From the jenkins master ~/.ssh" option, which automatically get the key from the location /var/jenkins_home/.ssh/ and use it when authenticating against the target git repository.
- Click save button in the popup.
- Click save button to the bottom of the configuration page for the job.
- Go to your github profile.
- Go to settings
- Go to SSH Keys
- Click on "Add SSH Key" button.
- Type in a title in the Title input, this is only a label to easy identify this entry.
- In the Key field, paste the content of your jenkins public key located in your jenkins container in /var/jenkins_home/.ssh/id_rsa.pub.
- Click "Add Key" green button to save the entry.
If you dont want a github account, and you just have a regular folder with a git initialization (git init --bare), in the step 5 of the "On Jenkins" section in this page, you should provide the url of that server repository, it should look like this anyei@myserver.com:repo.git, then do:
- Login to myserver.com.
- If doesn't exists, create an authorized_keys file in this path ~/.ssh:
$ touch ~/.ssh/authorized_keys
- Paste the content of your jenkins public key located in your container in /var/jenkins_home/.ssh/id_rsa.pub. Assuming your jenkins container's name is jenkins-sfdc Do:
$ docker exec -it jenkins-sfdc /bin/bash
$ cat ~/.ssh/id_rsa.pub | ssh anyei@myserver.com 'cat >> ~/.ssh/authorized_keys'
Now we have keys setup to in jenkins and in our repository, we just to go to our jenkins job and build!! (if you dont have the build.xml setup in your repository, read this article: Configuring Jenkins to Deploy to Salesforce with Migration Tools