diff --git a/cmd/argocd/commands/repo.go b/cmd/argocd/commands/repo.go index c040d703a2..3942fb2969 100644 --- a/cmd/argocd/commands/repo.go +++ b/cmd/argocd/commands/repo.go @@ -40,6 +40,7 @@ func NewRepoCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command { func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command { var ( repo appsv1.Repository + upsert bool sshPrivateKeyPath string ) var command = &cobra.Command{ @@ -75,7 +76,10 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command { } conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie() defer util.Close(conn) - repoCreateReq := repository.RepoCreateRequest{Repo: &repo} + repoCreateReq := repository.RepoCreateRequest{ + Repo: &repo, + Upsert: upsert, + } createdRepo, err := repoIf.Create(context.Background(), &repoCreateReq) errors.CheckError(err) fmt.Printf("repository '%s' added\n", createdRepo.Repo) @@ -84,6 +88,7 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command { command.Flags().StringVar(&repo.Username, "username", "", "username to the repository") command.Flags().StringVar(&repo.Password, "password", "", "password to the repository") command.Flags().StringVar(&sshPrivateKeyPath, "sshPrivateKeyPath", "", "path to the private ssh key (e.g. ~/.ssh/id_rsa)") + command.Flags().BoolVar(&upsert, "upsert", false, "Override an existing repository with the same name even if the spec differs") return command } diff --git a/server/repository/repository.go b/server/repository/repository.go index 08272b17b4..7e59f60fbf 100644 --- a/server/repository/repository.go +++ b/server/repository/repository.go @@ -2,9 +2,12 @@ package repository import ( "fmt" + "reflect" "github.com/ghodss/yaml" "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" appsv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" "github.com/argoproj/argo-cd/reposerver" @@ -112,7 +115,25 @@ func (s *Server) Create(ctx context.Context, q *RepoCreateRequest) (*appsv1.Repo if !s.enf.EnforceClaims(ctx.Value("claims"), "repositories", "create", fmt.Sprintf("*/%s", q.Repo.Repo)) { return nil, grpc.ErrPermissionDenied } - repo, err := s.db.CreateRepository(ctx, q.Repo) + r := q.Repo + repo, err := s.db.CreateRepository(ctx, r) + if status.Convert(err).Code() == codes.AlreadyExists { + // act idempotent if existing spec matches new spec + existing, getErr := s.db.GetRepository(ctx, r.Repo) + if getErr != nil { + return nil, status.Errorf(codes.Internal, "unable to check existing repository details: %v", err) + } + + // repository ConnectionState may differ, so make consistent before testing + existing.ConnectionState = r.ConnectionState + if reflect.DeepEqual(existing, r) { + repo, err = existing, nil + } else if q.Upsert { + return s.Update(ctx, &RepoUpdateRequest{Repo: r}) + } else { + return nil, status.Errorf(codes.InvalidArgument, "existing repository spec is different; use upsert flag to force update") + } + } return redact(repo), err } diff --git a/server/repository/repository.pb.go b/server/repository/repository.pb.go index 1680361330..c2ff028209 100644 --- a/server/repository/repository.pb.go +++ b/server/repository/repository.pb.go @@ -222,7 +222,8 @@ func (*RepoResponse) ProtoMessage() {} func (*RepoResponse) Descriptor() ([]byte, []int) { return fileDescriptorRepository, []int{6} } type RepoCreateRequest struct { - Repo *github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Repository `protobuf:"bytes,1,opt,name=repo" json:"repo,omitempty"` + Repo *github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Repository `protobuf:"bytes,1,opt,name=repo" json:"repo,omitempty"` + Upsert bool `protobuf:"varint,2,opt,name=upsert,proto3" json:"upsert,omitempty"` } func (m *RepoCreateRequest) Reset() { *m = RepoCreateRequest{} } @@ -237,6 +238,13 @@ func (m *RepoCreateRequest) GetRepo() *github_com_argoproj_argo_cd_pkg_apis_appl return nil } +func (m *RepoCreateRequest) GetUpsert() bool { + if m != nil { + return m.Upsert + } + return false +} + type RepoUpdateRequest struct { Repo *github_com_argoproj_argo_cd_pkg_apis_application_v1alpha1.Repository `protobuf:"bytes,1,opt,name=repo" json:"repo,omitempty"` } @@ -775,6 +783,16 @@ func (m *RepoCreateRequest) MarshalTo(dAtA []byte) (int, error) { } i += n3 } + if m.Upsert { + dAtA[i] = 0x10 + i++ + if m.Upsert { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } return i, nil } @@ -927,6 +945,9 @@ func (m *RepoCreateRequest) Size() (n int) { l = m.Repo.Size() n += 1 + l + sovRepository(uint64(l)) } + if m.Upsert { + n += 2 + } return n } @@ -1842,6 +1863,26 @@ func (m *RepoCreateRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Upsert", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRepository + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Upsert = bool(v != 0) default: iNdEx = preIndex skippy, err := skipRepository(dAtA[iNdEx:]) @@ -2054,51 +2095,52 @@ var ( func init() { proto.RegisterFile("server/repository/repository.proto", fileDescriptorRepository) } var fileDescriptorRepository = []byte{ - // 726 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xcd, 0x6e, 0xd3, 0x4a, - 0x14, 0x96, 0x9b, 0x36, 0xba, 0x3d, 0xa9, 0x7a, 0xdb, 0xb9, 0xbd, 0x55, 0xe4, 0x9b, 0xa6, 0x95, - 0xab, 0x2b, 0xf5, 0x5e, 0xa8, 0x4d, 0x03, 0x8b, 0xaa, 0xac, 0x28, 0xad, 0xaa, 0xaa, 0x2c, 0xc0, - 0x55, 0x91, 0x60, 0x41, 0xe5, 0x3a, 0x47, 0xae, 0x49, 0x32, 0x33, 0xcc, 0x4c, 0x2c, 0x45, 0xa8, - 0x1b, 0x16, 0x88, 0x35, 0xec, 0xd9, 0xf3, 0x0e, 0x3c, 0x00, 0x4b, 0x24, 0x5e, 0x00, 0x55, 0xec, - 0x78, 0x09, 0x34, 0x63, 0x27, 0x71, 0x9a, 0x9f, 0x55, 0xc4, 0xee, 0xcc, 0x99, 0x6f, 0xce, 0xf7, - 0xf9, 0x9b, 0x73, 0xc6, 0xe0, 0x48, 0x14, 0x09, 0x0a, 0x4f, 0x20, 0x67, 0x32, 0x56, 0x4c, 0x74, - 0x72, 0xa1, 0xcb, 0x05, 0x53, 0x8c, 0x40, 0x3f, 0x63, 0xaf, 0x44, 0x2c, 0x62, 0x26, 0xed, 0xe9, - 0x28, 0x45, 0xd8, 0x95, 0x88, 0xb1, 0xa8, 0x89, 0x5e, 0xc0, 0x63, 0x2f, 0xa0, 0x94, 0xa9, 0x40, - 0xc5, 0x8c, 0xca, 0x6c, 0xd7, 0x69, 0xec, 0x4a, 0x37, 0x66, 0x66, 0x37, 0x64, 0x02, 0xbd, 0x64, - 0xc7, 0x8b, 0x90, 0xa2, 0x08, 0x14, 0xd6, 0x33, 0xcc, 0x71, 0x14, 0xab, 0xcb, 0xf6, 0x85, 0x1b, - 0xb2, 0x96, 0x17, 0x08, 0x43, 0xf1, 0xd2, 0x04, 0xdb, 0x61, 0xdd, 0xe3, 0x8d, 0x48, 0x1f, 0x96, - 0x5e, 0xc0, 0x79, 0x33, 0x0e, 0x4d, 0x71, 0x2f, 0xd9, 0x09, 0x9a, 0xfc, 0x32, 0x18, 0x2a, 0xe5, - 0xec, 0xc3, 0x92, 0x8f, 0x9c, 0x9d, 0x48, 0x46, 0x29, 0xaa, 0x27, 0x6d, 0x14, 0x1d, 0x42, 0x60, - 0x56, 0x7f, 0x44, 0xd9, 0xda, 0xb0, 0xb6, 0xe6, 0x7d, 0x13, 0x13, 0x1b, 0xfe, 0x10, 0x98, 0xc4, - 0x32, 0x66, 0xb4, 0x3c, 0x63, 0xf2, 0xbd, 0xb5, 0x73, 0x04, 0x7f, 0xe5, 0x6a, 0xf8, 0x28, 0x39, - 0xa3, 0x12, 0xc9, 0x1d, 0x98, 0x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0x11, 0x8e, 0xbd, 0x9b, 0x29, 0x29, 0xd9, 0x34, 0x4a, 0xd6, 0xc8, 0x3f, 0x13, 0x7c, 0x22, - 0x1f, 0x2d, 0x28, 0xa6, 0xad, 0x3a, 0xec, 0xcf, 0x40, 0x0b, 0x4f, 0x4b, 0x95, 0x6b, 0x54, 0x6d, - 0xd9, 0x1b, 0xe3, 0x55, 0x19, 0x1d, 0x57, 0x99, 0x57, 0x2f, 0xa0, 0x78, 0x80, 0x4d, 0x54, 0x38, - 0xce, 0xad, 0xf2, 0xcd, 0x74, 0xaf, 0x51, 0x32, 0x03, 0xfe, 0x9f, 0x64, 0xc0, 0xfe, 0xfd, 0x2f, - 0xd7, 0x55, 0xeb, 0xeb, 0x75, 0xd5, 0xfa, 0x7e, 0x5d, 0xb5, 0x9e, 0x6f, 0x4f, 0xfa, 0x4d, 0x0e, - 0xfd, 0xca, 0x2f, 0x8a, 0xe6, 0x8f, 0x78, 0xf7, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x30, 0xd9, - 0x2b, 0xac, 0xe6, 0x07, 0x00, 0x00, + // 738 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0x96, 0x09, 0x58, 0x30, 0x41, 0x5c, 0x98, 0xcb, 0x45, 0x91, 0x6f, 0x08, 0x68, 0x50, 0x25, + 0xfa, 0x83, 0x5d, 0xd2, 0x2e, 0x10, 0x5d, 0x95, 0x82, 0x10, 0xa2, 0x8b, 0xd6, 0x88, 0x4a, 0xed, + 0xa2, 0xc8, 0x38, 0x47, 0xc6, 0x4d, 0x32, 0x33, 0x9d, 0x99, 0x58, 0x8a, 0x2a, 0x36, 0x5d, 0xa0, + 0xae, 0xdb, 0x7d, 0xf7, 0x7d, 0x87, 0x3e, 0x40, 0x97, 0x95, 0xfa, 0x02, 0x15, 0xea, 0xae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10, 0x62, 0xd8, 0x95, 0xc9, 0x50, 0x35, 0x76, 0x53, 0xeb, 0x7c, 0xb0, 0x50, 0xe1, 0x10, + 0x46, 0xde, 0xcd, 0x84, 0x98, 0x6c, 0x18, 0x26, 0xab, 0xf8, 0xff, 0x31, 0x3a, 0xe1, 0xcf, 0x16, + 0xb2, 0x53, 0xab, 0x0e, 0xea, 0xd3, 0x67, 0xe1, 0x49, 0xb1, 0x72, 0x0d, 0xab, 0x4d, 0x67, 0x7d, + 0x34, 0x2b, 0xc3, 0xe3, 0x32, 0xd3, 0xea, 0x35, 0xb2, 0xf7, 0xa1, 0x01, 0x0a, 0x46, 0xa9, 0x55, + 0xba, 0x99, 0xee, 0x1a, 0x25, 0x13, 0xe0, 0xce, 0x38, 0x01, 0xf6, 0x1e, 0x7d, 0xbb, 0xae, 0x58, + 0xdf, 0xaf, 0x2b, 0xd6, 0xcf, 0xeb, 0x8a, 0xf5, 0x6a, 0x6b, 0xdc, 0xfb, 0x39, 0xf0, 0xc6, 0x9f, + 0xdb, 0xe6, 0xa9, 0x7c, 0xf0, 0x27, 0x00, 0x00, 0xff, 0xff, 0xaf, 0xd2, 0x6e, 0x35, 0xff, 0x07, + 0x00, 0x00, } diff --git a/server/repository/repository.pb.gw.go b/server/repository/repository.pb.gw.go index dc2745fe66..5a15853f02 100644 --- a/server/repository/repository.pb.gw.go +++ b/server/repository/repository.pb.gw.go @@ -80,6 +80,10 @@ func request_RepositoryService_ListKsonnetApps_0(ctx context.Context, marshaler } +var ( + filter_RepositoryService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"repo": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + func request_RepositoryService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client RepositoryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq RepoCreateRequest var metadata runtime.ServerMetadata @@ -88,6 +92,10 @@ func request_RepositoryService_Create_0(ctx context.Context, marshaler runtime.M return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_RepositoryService_Create_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err diff --git a/server/repository/repository.proto b/server/repository/repository.proto index d05cbd666a..68ea67ecc5 100644 --- a/server/repository/repository.proto +++ b/server/repository/repository.proto @@ -57,6 +57,7 @@ message RepoResponse {} message RepoCreateRequest { github.com.argoproj.argo_cd.pkg.apis.application.v1alpha1.Repository repo = 1; + bool upsert = 2; } message RepoUpdateRequest {