diff --git a/Dockerfile.dev b/_Dockerfile.dev similarity index 100% rename from Dockerfile.dev rename to _Dockerfile.dev diff --git a/docker-compose.yml b/docker-compose.yml index 9266996801..e4b756d4ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: - redis build: context: . - dockerfile: Dockerfile.dev + dockerfile: _Dockerfile.dev ports: - 4141:4141 volumes: @@ -37,4 +37,4 @@ services: volumes: redis: - driver: local \ No newline at end of file + driver: local diff --git a/server/core/db/boltdb.go b/server/core/db/boltdb.go index 14641bf0af..685c672679 100644 --- a/server/core/db/boltdb.go +++ b/server/core/db/boltdb.go @@ -163,7 +163,7 @@ func (b *BoltDB) List() ([]models.ProjectLock, error) { for k, v := range locksBytes { var lock models.ProjectLock if err := json.Unmarshal(v, &lock); err != nil { - return locks, errors.Wrap(err, fmt.Sprintf("failed to deserialize lock at key '%d'", k)) + return locks, errors.Wrap(err, fmt.Sprintf("failed to deserialize lock at key %q", fmt.Sprint(k))) } locks = append(locks, lock) } diff --git a/server/events/post_workflow_hooks_command_runner.go b/server/events/post_workflow_hooks_command_runner.go index 37947ca169..7227d934ce 100644 --- a/server/events/post_workflow_hooks_command_runner.go +++ b/server/events/post_workflow_hooks_command_runner.go @@ -66,7 +66,7 @@ func (w *DefaultPostWorkflowHooksCommandRunner) RunPostHooks( log.Debug("got workspace lock") defer unlockFn() - repoDir, _, err := w.WorkingDir.Clone(log, headRepo, pull, DefaultWorkspace) + repoDir, _, err := w.WorkingDir.Clone(log, headRepo, pull, DefaultWorkspace, []string{}) if err != nil { return err } diff --git a/server/events/pre_workflow_hooks_command_runner.go b/server/events/pre_workflow_hooks_command_runner.go index 4bcb8aee20..b9bfe50efa 100644 --- a/server/events/pre_workflow_hooks_command_runner.go +++ b/server/events/pre_workflow_hooks_command_runner.go @@ -64,7 +64,7 @@ func (w *DefaultPreWorkflowHooksCommandRunner) RunPreHooks(ctx *command.Context, log.Debug("got workspace lock") defer unlockFn() - repoDir, _, err := w.WorkingDir.Clone(log, headRepo, pull, DefaultWorkspace) + repoDir, _, err := w.WorkingDir.Clone(log, headRepo, pull, DefaultWorkspace, []string{}) if err != nil { return err } diff --git a/server/events/project_command_runner.go b/server/events/project_command_runner.go index a252869db9..eb9197f999 100644 --- a/server/events/project_command_runner.go +++ b/server/events/project_command_runner.go @@ -522,7 +522,7 @@ func (p *DefaultProjectCommandRunner) doVersion(ctx command.ProjectContext) (ver func (p *DefaultProjectCommandRunner) doImport(ctx command.ProjectContext) (out *models.ImportSuccess, failure string, err error) { // Clone is idempotent so okay to run even if the repo was already cloned. - repoDir, _, cloneErr := p.WorkingDir.Clone(ctx.Log, ctx.HeadRepo, ctx.Pull, ctx.Workspace) + repoDir, _, cloneErr := p.WorkingDir.Clone(ctx.Log, ctx.HeadRepo, ctx.Pull, ctx.Workspace, []string{}) if cloneErr != nil { return nil, "", cloneErr } @@ -568,7 +568,7 @@ func (p *DefaultProjectCommandRunner) doImport(ctx command.ProjectContext) (out func (p *DefaultProjectCommandRunner) doStateRm(ctx command.ProjectContext) (out *models.StateRmSuccess, failure string, err error) { // Clone is idempotent so okay to run even if the repo was already cloned. - repoDir, _, cloneErr := p.WorkingDir.Clone(ctx.Log, ctx.HeadRepo, ctx.Pull, ctx.Workspace) + repoDir, _, cloneErr := p.WorkingDir.Clone(ctx.Log, ctx.HeadRepo, ctx.Pull, ctx.Workspace, []string{}) if cloneErr != nil { return nil, "", cloneErr } diff --git a/server/events/working_dir.go b/server/events/working_dir.go index 4fc97a3cf0..bf258b0602 100644 --- a/server/events/working_dir.go +++ b/server/events/working_dir.go @@ -103,12 +103,12 @@ func (w *FileWorkspace) Clone( } } - return cloneDir, w.warnDiverged(log, cloneDir), nil + return cloneDir, w.warnDiverged(log, p, headRepo, cloneDir), nil } // alreadyClonedHEAD determines whether the HEAD commit is already present in the cloneDir // repository. This can be used to determine whether we should force clone again. -func (w *FileWorkspace) alreadyClonedHEAD(log *logging.SimpleLogging, cloneDir string, p models.PullRequest) bool { +func (w *FileWorkspace) alreadyClonedHEAD(log logging.SimpleLogging, cloneDir string, p models.PullRequest) bool { // If the directory isn't there or isn't readable, we cannot already be cloned if _, err := os.Stat(cloneDir); err != nil { return false @@ -147,7 +147,7 @@ func (w *FileWorkspace) alreadyClonedHEAD(log *logging.SimpleLogging, cloneDir s // fetchBranch causes the repository to fetch the most recent version of the given branch // in a shallow fashion. This ensures we can access files from this branch, enabling later // reading of files from this revision. -func (w *FileWorkspace) fetchBranch(log *logging.SimpleLogging, cloneDir, branch string) (string, error) { +func (w *FileWorkspace) fetchBranch(log logging.SimpleLogging, cloneDir, branch string) (string, error) { log.Debug("fetching branch %s into repository %s", branch, cloneDir) fetchCmd := exec.Command("git", "fetch", "--depth=1", "origin", fmt.Sprintf("+refs/heads/%s:refs/remotes/origin/%s", branch, branch))