Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions controllers/codebasebranch/chain/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/epam/edp-codebase-operator/v2/controllers/codebasebranch/chain"
"github.com/epam/edp-codebase-operator/v2/controllers/codebasebranch/chain/clean_tmp_directory"
"github.com/epam/edp-codebase-operator/v2/controllers/codebasebranch/chain/empty"
"github.com/epam/edp-codebase-operator/v2/controllers/codebasebranch/chain/handler"
"github.com/epam/edp-codebase-operator/v2/controllers/codebasebranch/chain/put_branch_in_git"
Expand All @@ -28,7 +27,6 @@ func GetChain(c client.Client) handler.CodebaseBranchHandler {
Client: c,
Next: put_codebase_image_stream.PutCodebaseImageStream{
Client: c,
Next: &clean_tmp_directory.CleanTempDirectory{},
},
},
Service: &service.CodebaseBranchServiceProvider{
Expand Down
10 changes: 0 additions & 10 deletions controllers/codebasebranch/chain/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package chain

import (
"fmt"
"path"
"slices"

codebaseApi "github.com/epam/edp-codebase-operator/v2/api/v1"
"github.com/epam/edp-codebase-operator/v2/pkg/util"
)

// HasNewVersion checks if codebase branch has new version.
Expand All @@ -17,11 +15,3 @@ func HasNewVersion(codebaseBranch *codebaseApi.CodebaseBranch) (bool, error) {

return !slices.Contains(codebaseBranch.Status.VersionHistory, *codebaseBranch.Spec.Version), nil
}

func GetCodebaseBranchWorkingDirectory(codebaseBranch *codebaseApi.CodebaseBranch) string {
return path.Join(
util.GetWorkDir(codebaseBranch.Spec.CodebaseName, codebaseBranch.Namespace),
"codebase-branches",
codebaseBranch.Name,
)
}
13 changes: 0 additions & 13 deletions controllers/codebasebranch/codebasebranch_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,6 @@ func (r *ReconcileCodebaseBranch) tryToDeleteCodebaseBranch(ctx context.Context,
}
}

if err := removeDirectoryIfExists(cb.Spec.CodebaseName, cb.Name, cb.Namespace); err != nil {
return &reconcile.Result{}, fmt.Errorf("failed to remove codebase branch directory: %w", err)
}

err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
// Fetch the resource here; we need to refetch it on every try, since
// if we got a conflict on the last update attempt then we need to get
Expand All @@ -311,15 +307,6 @@ func (r *ReconcileCodebaseBranch) tryToDeleteCodebaseBranch(ctx context.Context,
return &reconcile.Result{}, nil
}

func removeDirectoryIfExists(codebaseName, branchName, namespace string) error {
wd := util.GetWorkDir(codebaseName, fmt.Sprintf("%v-%v", namespace, branchName))
if err := util.RemoveDirectory(wd); err != nil {
return fmt.Errorf("failed to remove directory %q: %w", wd, err)
}

return nil
}

// setFailureCount increments failure count and returns delay for next reconciliation.
func (r *ReconcileCodebaseBranch) setFailureCount(c *codebaseApi.CodebaseBranch) time.Duration {
const defaultDuration = 10 * time.Second
Expand Down
10 changes: 0 additions & 10 deletions pkg/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,9 @@ type Git interface {
// Init initializes a new git repository.
Init(ctx context.Context, directory string) error

// Fetch fetches changes from the remote repository.
// branchName: specific branch to fetch (empty string fetches all).
Fetch(ctx context.Context, directory, branchName string) error

// AddRemoteLink adds or updates the remote origin URL.
AddRemoteLink(ctx context.Context, directory, remoteURL string) error

// CommitExists checks if a commit with the given hash exists in the repository.
CommitExists(ctx context.Context, directory, hash string) (bool, error)

// CheckoutRemoteBranch fetches from remote and checks out the specified branch.
CheckoutRemoteBranch(ctx context.Context, directory, branchName string) error

// CreateRemoteTag creates a tag from a branch and pushes it to the remote repository.
CreateRemoteTag(ctx context.Context, directory, branchName, tagName string) error
}
Loading
Loading