Hello,
This year feb. I started working with Jenkins. Now I want to deploy new versions from SVN.
I understand there two ways:
[list]Push: initiative is at the side of SVN.[/list]
[list]Pull: initiative is at Jenkins side by polling.[/list]
On this moment I prefer the Push method, but...
Structure in SVN is:
> Implementation
> Data
[color=blue]> Tool
> tags
>Toolname-<version number> #Location 1: This is a directory and for every new version a directory will be added with files.
> all kind of files[/color]
[color=orange]> Tool
> tags
>Toolname-<version number> #Location 2: This is a directory and for every new version a directory will be added with files.
> all kind of files[/color]
1. Push Method:
I have found that at the SVN post-commit hook (at the repository/hook) has to be created like:
[code=Bash]
REPOS="$1"
REV="$2"
UUID=`svnlook uuid $REPOS`
/usr/bin/wget \
--header "Content-Type:text/plain;charset=UTF-8" \
--post-data "`svnlook changed --revision $REV $REPOS`" \
--output-document "-" \
--timeout=2 \
This is the 'simple' script version. There is also a 'Robust' version but to explain how does this work it make no difference if we look to the simple version or the robust version I think
I think at the Jenkins side I have to do:
1. I have to create a freestyle job with "Source Code Management" see my screenshot "2019-05-03 08_20_36-Jenkins_job SVN.png"
2. And do I have to create a "Remote Build trigger" see my screenshot "2019-05-03 08_28_06-Jenkins Build trigger.png"
But my question are:
1. What makes the connection between SVN and Jenkins?
- I understand if something is committed were does that script point to the instance of Jenkins? At which part is the connection declared?
- And were does that script make a kind of connection with that specific job? or is that ${UUID}
- And my idea is that pos-commit hook need to placed at the location of the repository were we are interested in. This means that if somenthing in SVN is commited, but that has nothing todo were we are not interested, the script will not be executed. Or does it work different?
2. What will trigger the Job? must I create a trigger "Trigger builds remotely"? If so, can I create any kind of token string? like my name? If I need this than I think I need also to fill that token at the SVN side or...?
3. And do I have to create for every SVN location a new Job and than also for every SVN location a post-commit hook script? I think so, but I'm not sure
2. Pull by Polling Method:
First thing to is not difficult, create a "Poll scm schedule" for the Crontab.
But than? What todo next?
My questions about polling are:
1. Now I have connection between Jenkins and SVN. I have the Cronjob running.
- But how do I know if there is a new version?
- How do I know which is the new version? Which directory is new and do I have to pick up from SVN
- And what does it trigger the job? I mean ok, If I have found with Jenkins the latest version to check-out, what made that the job is triggered and the build is started and the directory's/files's are checked out?
Or does any know a good tutorial were all this is explained? I have googled a lot and bought three books, I can't find the answers on these questions.
I hope that someone can help me out with this or point me in the direction, so that I can solve it by myself.
Or can someone explain to me what I do not understand and what my lack of knowledge is?
Thanks in advance.
With regards,
Nico