You can confirm that a reference repository is being used by looking for
the file .git/objects/info/alternates in the repository.

The file in my sample repository includes the text:

 /home/mwaite/git/bare/jenkins/jenkins.git/objects

On Mon, Feb 24, 2020 at 7:18 AM Amila Gunathilake <amilag.so...@gmail.com>
wrote:

>
> Hi Mark,
>
> This is the new master branch Jenkins Console output I'm getting.  There
> is no message says that I'm using GIT reference repository like-wise my
> previous console output in Pull Request.
>
> [image: Capture.PNG]
>
>
>
> So what will be the reason for this ?  Is everything okay with this
> console out-put ?
>
>
> Thanks,
> Amila
>
> On Monday, February 24, 2020 at 9:04:27 AM UTC-5, Amila Gunathilake wrote:
>>
>>
>> Hi Mark,
>>
>> Thanks for your reply and your sample job really helped me.  Here my New
>> Jenkinsfile checkout stage looks like.
>>
>> [image: Capture.PNG]
>>
>> I had successfully build the Pull Request this time, when I'm building
>> the PR below is the Console Output log I had from Jenkins.
>>
>> [image: Capture.PNG]
>>
>>
>>
>>
>>
>>
>>
>> *But after I merged my Pull Request into the master branch I'm just
>> getting below Console output for checkout stage without the message "using
>> Reference Repository"*
>> *Also after merge into master branch and after building in master branch
>> "**alternates**" file also missing from the workspace path - '*
>> *workspace\master411813f6\.git\objects\info*
>>
>> *' **is it everything okay?   I cannot find weather reference repository
>> is using or not ?  I'm 100% sure that my reference repository exists in
>> build server. *
>>
>> Thanks
>> Amila
>>
>>
>>
>> On Friday, February 21, 2020 at 12:00:49 AM UTC-5, Mark Waite wrote:
>>>
>>> As far as I can tell, you want to:
>>>
>>>    - Use declarative pipeline for clarity of the pipeline
>>>    - Skip the default checkout so that you can tune the performance of
>>>    checkout
>>>    - Perform your own checkout using a reference repository
>>>    - Use the same Jenkinsfile on branches and on pull requests so that
>>>    pull requests can be merged into target branches easily
>>>    - Checkout in the workspace to a branch with the same name as the
>>>    branch on the git server
>>>
>>> Based on those assumptions, I created a sample job
>>> <https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-61120/Jenkinsfile>
>>> and a pull request <https://github.com/MarkEWaite/jenkins-bugs/pulls>
>>> that targets the master branch
>>> <https://github.com/MarkEWaite/jenkins-bugs/blob/master/Jenkinsfile> and
>>> meets those requirements.  When a pull request is being evaluated, the
>>> changes on the pull request are detected and used.  When the master branch
>>> is being evaluated, its changes are detected and used.
>>>
>>> Please refer to the sample job and the techniques used in the sample
>>> job.  Note that you will need the most recent release of the git plugin for
>>> references to the scm variable.
>>>
>>> Mark Waite
>>>
>>> On Thu, Feb 20, 2020 at 12:21 AM Amila Gunathilake <amila...@gmail.com>
>>> wrote:
>>>
>>>> [image: 101Capture.PNG]
>>>>
>>>>
>>>>
>>>> Hi Mark,
>>>>
>>>> After I did your changes Jenkins log/console-output gives below error
>>>> message.
>>>> [image: 100Capture.PNG]
>>>>
>>>> [image: 101Capture.PNG]
>>>>
>>>>
>>>>
>>>> So as per the above error after your requested changes its not
>>>> downloading code from remote repo.  Please see below screenshots of Builder
>>>> node's workspace folder, which you can have any idea.
>>>>
>>>>
>>>> [image: 102Capture.PNG]
>>>>
>>>>
>>>>
>>>> In above Workspace folder as you can see there are no any other my
>>>> remote repository files, only having the .git folder.  Which is because of
>>>> the above error Couldn't find any revision to build
>>>>
>>>>
>>>> I think Couldn't find any revision to build error coming from after we
>>>> changed branch name into "branches: [[name: env.BRANCH_NAME]]"
>>>>
>>>> Please suggest any other ideas.
>>>>
>>>> Thanks
>>>> Amila
>>>>
>>>>
>>>> On Thursday, February 20, 2020 at 2:11:27 AM UTC-5, Amila Gunathilake
>>>> wrote:
>>>>>
>>>>>
>>>>> Hi Mark,
>>>>>
>>>>> After I did your changes Jenkins log/console-output gives below error
>>>>> message.
>>>>>
>>>>> [image: 100Capture.PNG]
>>>>>
>>>>>
>>>>> [image: 101Capture.PNG]
>>>>>
>>>>>
>>>>> So as per the above error after your requested changes its not
>>>>> downloading code from remote repo.  Please see below screenshots of 
>>>>> Builder
>>>>> node's workspace folder, which you can have any idea.
>>>>>  [image: 102Capture.PNG]
>>>>>
>>>>>
>>>>>
>>>>> In above Workspace folder as you can see there are no any other my
>>>>> remote repository files, only having the .git folder.  Which is because of
>>>>> the above error Couldn't find any revision to build
>>>>>
>>>>>
>>>>> I think Couldn't find any revision to build error coming from after
>>>>> we changed branch name into "branches: [[name: env.BRANCH_NAME]]"
>>>>>
>>>>> Please suggest any other ideas.
>>>>>
>>>>> Thanks
>>>>> Amila
>>>>>
>>>>>
>>>>>
>>>>> On Wednesday, February 19, 2020 at 8:39:30 PM UTC-5, Mark Waite wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tuesday, February 18, 2020 at 6:09:43 PM UTC-7, Amila Gunathilake
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I'm having the below issue.
>>>>>>>
>>>>>>> I was change my code to use GIT Reference repository in Jenkinsfile
>>>>>>> code such as below.
>>>>>>>
>>>>>>>
>>>>>>> [image: image-2020-02-18-04-21-49-733.png]
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> So I made a new pull request in GIT-HUB for the purpose of merge
>>>>>>> these changes into my master branch.
>>>>>>>
>>>>>>> But when the Pull-Request running I saw in my builder machine
>>>>>>> (workspace) its not downloading (fetching) the relevant Remote 
>>>>>>> Pull-Request
>>>>>>> Head/Branch/ because in my workspace (builder-machine) local branch 
>>>>>>> always
>>>>>>> checkout with the master branch and fetching from the master branch and 
>>>>>>> not
>>>>>>> checkout for the correct Pull Request Head.
>>>>>>>
>>>>>>> [image: image-2020-02-18-04-44-45-417.png]
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> eg: Above screenshot is the way that my local workspace's .git >
>>>>>>> HEAD file looks like in the Pull Request I created after above code
>>>>>>> changes. And as you can see in the HEAD file it's automatically 
>>>>>>> checkout in
>>>>>>> to the master branch instead of checking out into the relevant 
>>>>>>> Pull-Request
>>>>>>> hash (tag).
>>>>>>>
>>>>>>>    - But below is the correct screenshot I captured from any of
>>>>>>>    other Pull Requests, which should be the correct way to show the 
>>>>>>> checkout
>>>>>>>    branch or the HEAD.
>>>>>>>
>>>>>>>
>>>>>>> [image: image-2020-02-18-04-46-58-927.png]
>>>>>>>
>>>>>>> I hope you will understand my situation here? Please let me know if
>>>>>>> you guys need further information.
>>>>>>>
>>>>>>> *I throughly suggest that I want some code to replace above Yellow
>>>>>>> color highlighted sections.*
>>>>>>>
>>>>>>> So please could anyone please give some advice regarding this issue
>>>>>>> ?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> The value of 'branches' that you're using is incorrect.  In the
>>>>>> triggers section you're declaring that if the env.BRANCH_NAME is master,
>>>>>> then perform builds on a specific schedule.  Use the same
>>>>>> env.BRANCH_NAME in the branches section by changing from:
>>>>>>
>>>>>> branches: [[name: 'origin/* ]]
>>>>>>
>>>>>>
>>>>>> to:
>>>>>>
>>>>>> branches: [[name: env.BRANCH_NAME]]
>>>>>>
>>>>>>
>>>>>> If the env.BRANCH_NAME is defined for the trigger case, then it
>>>>>> should also be defined and available to use when defining the branch 
>>>>>> name.
>>>>>>
>>>>>> The duplicate value of refspec will likely prevent the checkout from
>>>>>> detecting any changes in your repository.  Change from:
>>>>>>
>>>>>> refspec: "+refs/heads/*:refs/remotes/origin/*",
>>>>>>
>>>>>> refspec: "+refs/heads/pr/*:refs/remotes/origin/pr/*",
>>>>>>
>>>>>>
>>>>>> to:
>>>>>>
>>>>>> refspec: "+refs/heads/*:refs/remotes/origin/*
>>>>>> +refs/heads/pr/*:refs/remotes/origin/pr/*",
>>>>>>
>>>>>>
>>>>>> The syntax you're using provides a value for refspec then replaces it
>>>>>> with a different value for refspec.  The corrected syntax provides the
>>>>>> default refspec plus the "pr" namespace refspec as a single argument so
>>>>>> that both will be used.
>>>>>>
>>>>>> Mark Waite
>>>>>>
>>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Jenkins Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to jenkins...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/d69b5c1c-e4f8-42e4-ba75-084ada0b653a%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/d69b5c1c-e4f8-42e4-ba75-084ada0b653a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/f5630876-867e-4b30-9de5-1d28fa8f8eec%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/f5630876-867e-4b30-9de5-1d28fa8f8eec%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtH4PGepdJm88rWuK7jEepW9Z07mX2ARRUoS6HH85WGCOg%40mail.gmail.com.

Reply via email to