'checkout' not working - I'm stuck on master?

*Edit - A bulleted list seems to conserve the indentations in config.yml. If there’s a better way to do this, I can change it.

Thank you in advance for any advice or suggestions on what I’m doing wrong here.

My tests only seem to run on the origin/master branch on Github.

I’m running a Docker executor, which sets up my environment, clones my repo, and does an initial build.

My workflow has the following sequence of jobs jobs, which:

  1. rebuilds, stores stdout as an artifact, and persists the build directory to my workspace.
  2. attaches the previous workspace, and prints the current commit hash, which matches the HEAD of origin/master.

My config.yml is pasted below.

  • version: 2

  • jobs:

  • build:

  • docker:
    
  •   - image: sgpearse/vapor3-ubuntu16:latest
    
  • steps:
    
  •   - checkout
    
  •   - run:
    
  •       name: cmake and make
    
  •       command: |
    
  •         cd /VAPOR
    
  •         cd build
    
  •         cmake ..
    
  •         make &> buildResults.txt
    
  •         ls ../test_apps
    
  •   - store_artifacts:
    
  •       path: /VAPOR/build/buildResults.txt
    
  •       destination: build-results
    
  •   - persist_to_workspace:
    
  •       root: /
    
  •       paths: VAPOR
    
  • checkWarnings:

  • docker:
    
  •   - image: sgpearse/vapor3-ubuntu16:latest
    
  • steps:
    
  •   - attach_workspace:
    
  •       at: /
    
  •   - run:
    
  •       name: Checking for warnings
    
  •       command: |
    
  •         cd /VAPOR
    
  •         git branch
    
  •         echo ' v log v'
    
  •         git log
    
  •         git status
    
  •         echo ' ^ log ^'
    
  •         echo ''
    
  •         echo $CIRCLE_TAG
    
  •         echo ''
    
  •         echo $CIRCLE_BRANCH
    
  •         echo ''
    
  •         ls /VAPOR
    
  •         echo ''
    
  •         ls /VAPOR/test_apps
    
  •         echo ''
    
  •         ls /VAPOR/test_apps/circleTests
    
  •         /VAPOR/test_apps/circleTests/checkForWarnings.sh
    
  • testVersion:

  • docker:
    
  •   - image: sgpearse/vapor3-ubuntu16:latest
    
  • steps:
    
  •   - attach_workspace:
    
  •       at: /
    
  •   - run:
    
  •       name: Running tests
    
  •       command: |
    
  •         /VAPOR/build/bin/vaporversion > /version.txt
    
  •   - store_artifacts:
    
  •       path: /version.txt
    
  •       destination: vapor-version-info
    
  • workflows:

  • version: 2

  • build:

  • jobs:
    
  •   - build
    
  •   - checkWarnings:
    
  •       requires:
    
  •         - build
    
  •   - testVersion:
    
  •       requires:
    
  •         - build
1 Like

Did you figure this out at all? We want to only build branches prefixed with “submit_” then

  1. Run git checkout {branchname}
  2. Run git merge master
  3. If fails, bail, else next…
  4. Run the build
  5. If fails, bail, else next…
  6. Run git checkout master
  7. Run git merge {branchname}
  8. Run git push (to put these changes on master)

We keep a git hook for master so no users but our build can checkin to master. How do we do this with circle CI though? (we used to do this with jenkins so that master was always a successful solid build except for flaky tests of course).

I am not sure this answers the original question but might help someone who stumbles upon this post.
Our final version that we had to do quite a bit of rework on circle CI’s weird checkout to undo whatever they were trying to do AND squash all commits from the author submitting are like so

This ensures master always works.