-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added freight ref to warehouse status and repo-commit mappings fetcher
Signed-off-by: Maksim Stankevic <[email protected]>
- Loading branch information
1 parent
467a3cd
commit d8aff35
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package warehouses | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/pkg/errors" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
kargoapi "github.com/akuity/kargo/api/v1alpha1" | ||
) | ||
|
||
func (r *reconciler) getGitRepoCommitsMappings( | ||
ctx context.Context, | ||
freightId string, | ||
ns string, | ||
) (map[string][]string, error) { | ||
|
||
freight := kargoapi.Freight{} | ||
if err := r.client.Get( | ||
ctx, | ||
client.ObjectKey{ | ||
Namespace: ns, | ||
Name: freightId, | ||
}, | ||
&freight, | ||
); err != nil { | ||
return nil, errors.Wrapf( | ||
err, | ||
"error checking for existence of Freight with ID %q", | ||
freightId, | ||
) | ||
} | ||
|
||
result := map[string][]string{} | ||
for _, commit := range freight.Commits { | ||
result[commit.RepoURL] = []string{commit.ID, commit.Branch} | ||
} | ||
|
||
return result, nil | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters