Skip to content

Submodules not reset

Summary

The runner does not reset changes in a submodule or clean it.

Steps to reproduce

  1. Create two projects
  2. Include the second as a submodule of the first
  3. Write a CI job for the first that involves changes to the second and creates files in the submodule directory
  4. Commit and push - gitlab runs CI job, files are modified and generated
  5. Update the submodule to a different commit
  6. Commit and push

Actual behavior

  1. The runner cleans out the first project
  2. The runner checks out the new commit of the first project (forced, overwrites changes)
  3. The runner attempts to checkout the new commit of the submodule
  4. The runner fails with "error: Your local changes to the following files would be overwritten by checkout:"

Expected behavior

  1. The runner cleans out the first project
  2. The runner checks out the new commit of the first project (forced, overwrites changes)
  3. The runner cleans the submodule directory/second project
  4. The runner checks out the new commit of the submodule/second project (forced, overwrites changes)

Relevant logs and/or screenshots

Running with gitlab-runner 10.1.0 (c1ecf97f)
  on Windows Powershell Runner [BUILDSERVER] (ead08551)
Using Shell executor...
Running on BUILDSERVER...
Fetching changes...
Removing <FILES>
HEAD is now at fcfa964 Fix test
From http://mss-git01.MillenniumSpaceSystems.local/group/project
   fcfa964..931d7e9  develop    -> origin/develop
Checking out 931d7e98 as develop...
Updating/initializing submodules...
Synchronizing submodule url for '.libs/MyLib'
From http://mss-git01.MillenniumSpaceSystems.local/group/my-lib
   b754737..95c8bd5  develop    -> origin/develop
error: Your local changes to the following files would be overwritten by checkout:
    <FILES>
Please commit your changes or stash them before you switch branches.
Aborting
Unable to checkout '4d835186b403ef89a67c7bebface51526d436aed' in submodule path '.libs/MyLib'
ERROR: Job failed: exit status 1

Environment description

Custom installation (gitlab-ce 10.1), gitlab-runner 10.1.0 on a Windows Server 2016 VM, Git for Windows 2.13.2.windows.1.

The runner is a shell runner using PowerShell. NOT containerized.

Used GitLab Runner version

Version:      10.1.0
Git revision: c1ecf97f
Git branch:   10-1-stable
GO version:   go1.8.3
Built:        Sat, 21 Oct 2017 21:33:18 +0000
OS/Arch:      windows/amd64