Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(manifest-repo-export-service): Changed fetch from HEAD to direct reference #2055

Merged
merged 23 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ba42f51
Added/Fixed some traces
diogo-nogueira-freiheit Oct 15, 2024
bc2bc17
Add some logs for dev-env
diogo-nogueira-freiheit Oct 16, 2024
5b934b8
removed bad spans
diogo-nogueira-freiheit Oct 16, 2024
ce0abab
removed useless comment
diogo-nogueira-freiheit Oct 16, 2024
b314140
Merge branch 'main' into dn/double_commits
diogo-nogueira-freiheit Oct 16, 2024
92a1c49
Removed useless call to WorkDir
diogo-nogueira-freiheit Oct 16, 2024
a91fcb5
Merge branch 'dn/double_commits' of github.com:freiheit-com/kuberpult…
diogo-nogueira-freiheit Oct 16, 2024
965d7c1
Solved linting issue
diogo-nogueira-freiheit Oct 16, 2024
b6da59f
New spans
diogo-nogueira-freiheit Oct 16, 2024
cc16567
removed trah
diogo-nogueira-freiheit Oct 16, 2024
e591b23
Useless empty lines removed
diogo-nogueira-freiheit Oct 16, 2024
aff7d6f
Reseted mock flag
diogo-nogueira-freiheit Oct 16, 2024
d3a4a71
fix(db): select query was ignoring recent eslversion if they were del…
diogo-nogueira-freiheit Oct 17, 2024
dd36ff3
Fixed some stuf
diogo-nogueira-freiheit Oct 17, 2024
01569f4
Merge branch 'main' into dn/double_commits
diogo-nogueira-freiheit Oct 17, 2024
da8c7dd
Added new test for deleted release case
diogo-nogueira-freiheit Oct 17, 2024
10313c2
Fixed test cases and added new one
diogo-nogueira-freiheit Oct 17, 2024
4a79c5e
Fixed span names
diogo-nogueira-freiheit Oct 17, 2024
dc97e65
Added ordering to the queries
diogo-nogueira-freiheit Oct 17, 2024
6acc325
Fixed transformer db test
diogo-nogueira-freiheit Oct 17, 2024
6a5c579
Fixed integration test
diogo-nogueira-freiheit Oct 21, 2024
97f6af9
Changed the fetch head commit to fetch the direct ref instead
diogo-nogueira-freiheit Oct 21, 2024
e479018
Merge branch 'main' into dn/double_commits
diogo-nogueira-freiheit Oct 21, 2024
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
4 changes: 2 additions & 2 deletions services/manifest-repo-export-service/pkg/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ func processEsls(ctx context.Context, repo repository.Repository, dbHandler *db.
}

//Get latest commit. Write esl timestamp and commit hash.
commit, err := repo.GetHeadCommit()
commitId, err := repo.GetHeadCommitId()
if err != nil {
return err
}
return dbHandler.DBWriteCommitTransactionTimestamp(ctx, transaction, commit.Id().String(), esl.Created)
return dbHandler.DBWriteCommitTransactionTimestamp(ctx, transaction, commitId.String(), esl.Created)
})
if err != nil {
err3 := repo.FetchAndReset(ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type Repository interface {
StateAt(oid *git.Oid) (*State, error)
FetchAndReset(ctx context.Context) error
PushRepo(ctx context.Context) error
GetHeadCommit() (*git.Commit, error)
GetHeadCommitId() (*git.Oid, error)
}

type TransformerBatchApplyError struct {
Expand Down Expand Up @@ -418,17 +418,13 @@ func (r *repository) PushRepo(ctx context.Context) error {
return nil
}

func (r *repository) GetHeadCommit() (*git.Commit, error) {
ref, err := r.repository.Head()
func (r *repository) GetHeadCommitId() (*git.Oid, error) {
branchHead := fmt.Sprintf("refs/heads/%s", r.config.Branch)
ref, err := r.repository.References.Lookup(branchHead)
if err != nil {
return nil, fmt.Errorf("Error fetching HEAD: %v", err)
return nil, fmt.Errorf("Error fetching reference \"%s\": %v", branchHead, err)
}
commit, err := r.repository.LookupCommit(ref.Target())
if err != nil {
return nil, fmt.Errorf("Error transalting into commit: %v", err)
}
return commit, nil

return ref.Target(), nil
}

func (r *repository) ApplyTransformersInternal(ctx context.Context, transaction *sql.Tx, transformer Transformer) ([]string, *State, []*TransformerResult, *TransformerBatchApplyError) {
Expand Down
Loading