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 runs, the svn checkout step is implemented 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 checkout -c

A much faster way is to create your own Dockerfile that includes the client you need and then define 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 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

Define the environment variables in Codefresh shared configuration.

CI/CD pipeline examples
Native Git checkout
Running custom git commands
Steps in pipelines