Skip to content

Commit

Permalink
Merge pull request #127 from abelhoula/feature/scoped-repositories
Browse files Browse the repository at this point in the history
feat(scopedrepository): add support for project scoped repository
  • Loading branch information
MisterMX authored Jan 19, 2024
2 parents 7d5eaa5 + aee8788 commit 5423b08
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apis/repositories/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ type RepositoryParameters struct {
// type of the repo, maybe "git or "helm, "git" is assumed if empty or absent
// +optional
Type *string `json:"type,omitempty"`
// Project is a reference to the project with scoped repositories
// +optional
// only for git repos
Project *string `json:"project,omitempty"`
// only for Helm repos
// +optional
Name *string `json:"name,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions apis/repositories/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions examples/repositories/repository.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,20 @@ spec:
key: token
providerConfigRef:
name: argocd-provider
---
apiVersion: repositories.argocd.crossplane.io/v1alpha1
kind: Repository
metadata:
name: example-scoped-project.git
spec:
forProvider:
project: example-project # project scoped repository
repo: https://gitlab.com/example-group/example-project-scoped.git
type: git
username: example-user
passwordRef:
name: example-project.git
namespace: crossplane-system
key: token
providerConfigRef:
name: argocd-provider
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ spec:
- name
- namespace
type: object
project:
description: Project is a reference to the project with scoped
repositories only for git repos
type: string
repo:
description: URL of the repo
type: string
Expand Down
6 changes: 6 additions & 0 deletions pkg/controller/repositories/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ func generateCreateRepositoryOptions(p *v1alpha1.RepositoryParameters) *reposito
if p.Type != nil {
repo.Type = *p.Type
}
if p.Project != nil {
repo.Project = *p.Project
}
if p.Name != nil {
repo.Name = *p.Name
}
Expand Down Expand Up @@ -360,6 +363,9 @@ func generateUpdateRepositoryOptions(p *v1alpha1.RepositoryParameters) *reposito
if p.Type != nil {
repo.Type = *p.Type
}
if p.Project != nil {
repo.Project = *p.Project
}
if p.Name != nil {
repo.Name = *p.Name
}
Expand Down

0 comments on commit 5423b08

Please sign in to comment.