Checking out from other Source Control systems

Work with non-git repositories

Codefresh has Native Git support but you can still use any other version control system such as SVN, CVS, hg, etc.

The only requirement is that you find or create a Docker image that contains the client for that source control system and then use a freestyle step to run it.

Checking out Subversion code

There is already a public Docker image with the svn client, so it is very easy to run it in a Codefresh pipeline.

version: '1.0'
    title: Performing SVN checkout
    image: jgsqware/svn-client
      - pwd
      - rm -rf audacity-svn
      - svn checkout audacity-svn
    title: 'Listing files'
    image: alpine:latest
      - 'ls -l /codefresh/volume/'     

Notice the rm command before the clone step. This makes sure that every time the pipeline will run the svn checkout step will happen in an empty directory.

Checking out Mercurial or CVS Code

It is very simple to use any other Source control system in a Codefresh pipeline. The easiest way is to just call the respective executable. Here are two examples:

version: '1.0'
    title: Using HG
    image: alpine:latest
      - apk add --no-cache mercurial
      - hg --version
      - hg clone mercurial-repo
    title: Using CVS 
    image: alpine:latest
      - apk add --no-cache cvs
      - cvs --version
      - cvs -d :pserver:[email protected]:/home/cvsroot checkout -c

A much faster way is to create your own Dockerfile that includes the client you need and then mention that image directly in the freestyle step.

Checking out Perforce code

Codefresh has created a Perforce plugin which packs the p4 client into a Docker image in order to be used from Codefresh pipelines:

version: '1.0'
    title: Performing Perforce checkout
    image: codefresh/cf-p4-plugin:latest
      - mkdir -p /codefresh/volume/p4repo/ 
      - p4 client -o | grep -v '#' | sed  '/Root:/c\Root:/codefresh/volume/p4repo/' | p4 client -i
      - cd /codefresh/volume/p4repo/ && p4 rec
      - 'ls -la'
      - P4PORT=serveradress:serverport
      - P4CLIENT=clientname
      - P4USER=username
      - P4PASSWD=password

The environments variables should be defined in Codefresh shared configuration.