Pipeline git an LFS project

97 views
Skip to first unread message

Leandro Cofre

unread,
Aug 17, 2018, 9:42:50 AM8/17/18
to Jenkins Users
Hi,

I have a pipeline where I checkout two repositories, one with source code and the other with binaries that are part of the release. The latter uses the LFS git plugin.

My question is if there's a simpler way to declare I want to clone a git LFS repo other than the one I write below. The other repo description looks much simpler.

I also noticed the configuration for the LFS repo left the HEAD detached.

Thanks very much for your help.


pipeline {
    agent any

    stages {
        stage('Checkout') {
            steps {
                dir('content') {
                    checkout scm: [
                        $class: 'GitSCM',
                        branches: [[name: 'refs/heads/master']],
                        extensions: [[$class: 'GitLFSPull']],
                        userRemoteConfigs: [[
                            credentialsId: 'TheID',
                            url: 'https://bitbucket.org/COMPANY/content.git'
                        ]]
                    ]
                }
                
                
                dir('source') {
                    git branch: 'master',
                        url: 'https://bitbucket.org/COMPANY/source.git',
                        credentialsId: 'TheID'
                }
            }
        }
        stage('Build') {
            steps {
                echo 'Building....'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying....'
            }
        }
    }
}

Mark Waite

unread,
Aug 17, 2018, 9:48:56 AM8/17/18
to jenkins...@googlegroups.com
https://jenkins.io/blog/2017/10/02/pipeline-templates-with-shared-libraries/ describes how a Pipeline shared library can extract common statements from a declarative Pipeline to simplify the declarative Pipeline.

There isn't a way to perform a git LFS fetch or checkout with the "git" step.  The "git" step is a simplified form of the "checkout" step.  It intentionally does not include all the options and capabilities of the "checkout" step.

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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ec91fa16-de19-4b1b-aa11-0b3559418afb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Leandro Cofre

unread,
Aug 17, 2018, 10:53:32 AM8/17/18
to Jenkins Users
Good to know that's the answer. Thanks very much.
Reply all
Reply to author
Forward
0 new messages