Skip to content

Commit

Permalink
refactor: rename insecure oci field to insecureOciForceHttp
Browse files Browse the repository at this point in the history
Signed-off-by: Blake Pettersson <[email protected]>
  • Loading branch information
blakepettersson committed Dec 11, 2024
1 parent 0982bbc commit 142584f
Show file tree
Hide file tree
Showing 17 changed files with 848 additions and 848 deletions.
6 changes: 3 additions & 3 deletions assets/swagger.json

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

10 changes: 5 additions & 5 deletions cmd/argocd/commands/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
errors.CheckError(fmt.Errorf("Must specify --name for repos of type 'helm'"))
}

if repoOpts.Repo.Type == "oci" && repoOpts.InsecureOCI {
repoOpts.Repo.InsecureOCIHttpOnly = repoOpts.InsecureOCI
if repoOpts.Repo.Type == "oci" && repoOpts.InsecureOCIForceHttp {
repoOpts.Repo.InsecureOCIForceHttp = repoOpts.InsecureOCIForceHttp
}

conn, repoIf := headless.NewClientOrDie(clientOpts, c).NewRepoClientOrDie()
Expand All @@ -200,7 +200,7 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
}

// We let the server check access to the repository before adding it. If
// it is a private repo, but we cannot access with with the credentials
// it is a private repo, but we cannot access with the credentials
// that were supplied, we bail out.
//
// Skip validation if we are just adding credentials template, chances
Expand All @@ -225,7 +225,7 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
Project: repoOpts.Repo.Project,
GcpServiceAccountKey: repoOpts.Repo.GCPServiceAccountKey,
ForceHttpBasicAuth: repoOpts.Repo.ForceHttpBasicAuth,
InsecureOciHttpOnly: repoOpts.Repo.InsecureOCIHttpOnly,
InsecureOciForceHttp: repoOpts.Repo.InsecureOCIForceHttp,
}
_, err := repoIf.ValidateAccess(ctx, &repoAccessReq)
errors.CheckError(err)
Expand All @@ -241,7 +241,7 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
},
}
command.Flags().BoolVar(&repoOpts.Upsert, "upsert", false, "Override an existing repository with the same name even if the spec differs")
command.Flags().BoolVar(&repoOpts.InsecureOCI, "insecure-oci", false, "Use http when accessing an OCI repository")
command.Flags().BoolVar(&repoOpts.InsecureOCIForceHttp, "insecure-oci-force-http", false, "Use http when accessing an OCI repository")
cmdutil.AddRepoFlags(command, &repoOpts)
return command
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/util/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type RepoOptions struct {
Repo appsv1.Repository
Upsert bool
SshPrivateKeyPath string
InsecureOCI bool
InsecureOCIForceHttp bool
InsecureIgnoreHostKey bool
InsecureSkipServerVerification bool
TlsClientCertPath string
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/commands/argocd_repo_add.md

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

168 changes: 84 additions & 84 deletions pkg/apiclient/repository/repository.pb.go

Large diffs are not rendered by default.

1,466 changes: 733 additions & 733 deletions pkg/apis/application/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/apis/application/v1alpha1/generated.proto

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

2 changes: 1 addition & 1 deletion pkg/apis/application/v1alpha1/openapi_generated.go

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

10 changes: 5 additions & 5 deletions pkg/apis/application/v1alpha1/repository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ type Repository struct {
ForceHttpBasicAuth bool `json:"forceHttpBasicAuth,omitempty" protobuf:"bytes,22,opt,name=forceHttpBasicAuth"`
// NoProxy specifies a list of targets where the proxy isn't used, applies only in cases where the proxy is applied
NoProxy string `json:"noProxy,omitempty" protobuf:"bytes,23,opt,name=noProxy"`
// InsecureOCIHttpOnly specifies whether the connection to the repository uses TLS at _all_. If true, no TLS. This flag is applicable for OCI repos only.
InsecureOCIHttpOnly bool `json:"insecureOCIHttpOnly,omitempty" protobuf:"bytes,24,opt,name=insecureOCIHttpOnly"`
// InsecureOCIForceHttp specifies whether the connection to the repository uses TLS at _all_. If true, no TLS. This flag is applicable for OCI repos only.
InsecureOCIForceHttp bool `json:"insecureOCIForceHttp,omitempty" protobuf:"bytes,24,opt,name=insecureOCIForceHttp"`
}

// IsInsecure returns true if the repository has been configured to skip server verification or set to HTTP only
func (repo *Repository) IsInsecure() bool {
return repo.InsecureIgnoreHostKey || repo.Insecure || repo.InsecureOCIHttpOnly
return repo.InsecureIgnoreHostKey || repo.Insecure || repo.InsecureOCIForceHttp
}

// IsLFSEnabled returns true if LFS support is enabled on repository
Expand Down Expand Up @@ -152,7 +152,7 @@ func (repo *Repository) CopyCredentialsFromRepo(source *Repository) {
if repo.GCPServiceAccountKey == "" {
repo.GCPServiceAccountKey = source.GCPServiceAccountKey
}
repo.InsecureOCIHttpOnly = source.InsecureOCIHttpOnly
repo.InsecureOCIForceHttp = source.InsecureOCIForceHttp
repo.ForceHttpBasicAuth = source.ForceHttpBasicAuth
}
}
Expand Down Expand Up @@ -241,7 +241,7 @@ func (repo *Repository) GetOCICreds() oci.Creds {
CertData: []byte(repo.TLSClientCertData),
KeyData: []byte(repo.TLSClientCertKey),
InsecureSkipVerify: repo.Insecure,
InsecureHttpOnly: repo.InsecureOCIHttpOnly,
InsecureHttpOnly: repo.InsecureOCIForceHttp,
}
}

Expand Down
2 changes: 1 addition & 1 deletion server/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ func (s *Server) ValidateAccess(ctx context.Context, q *repositorypkg.RepoAccess
GitHubAppEnterpriseBaseURL: q.GithubAppEnterpriseBaseUrl,
Proxy: q.Proxy,
GCPServiceAccountKey: q.GcpServiceAccountKey,
InsecureOCIHttpOnly: q.InsecureOciHttpOnly,
InsecureOCIForceHttp: q.InsecureOciForceHttp,
}

// If repo does not have credentials, check if there are credentials stored
Expand Down
2 changes: 1 addition & 1 deletion server/repository/repository.proto
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ message RepoAccessQuery {
// Whether to force HTTP basic auth
bool forceHttpBasicAuth = 19;
// Whether https should be disabled for an OCI repo
bool insecureOciHttpOnly = 20;
bool insecureOciForceHttp = 20;
}

message RepoResponse {}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/fixture/repos/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func AddOCIRepo(name, imagePath string) {
fmt.Sprintf("%s/%s", fixture.OCIHostURL, imagePath),
"--type", "oci",
"--name", name,
"--insecure-oci",
"--insecure-oci-force-http",
}
errors.FailOnErr(fixture.RunCli(args...))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const RepoDetails = (props: {repo: models.Repository; save?: (params: New
project: repo.project || '',
enableOCI: repo.enableOCI || false,
forceHttpBasicAuth: repo.forceHttpBasicAuth || false,
insecureOCIHttpOnly: repo.insecureOCIHttpOnly || false
insecureOCIForceHttp: repo.insecureOCIForceHttp || false
};

return (
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/settings/components/repos-list/repos-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export interface NewHTTPSRepoParams {
project?: string;
forceHttpBasicAuth?: boolean;
enableOCI: boolean;
insecureOCIHttpOnly: boolean;
insecureOCIForceHttp: boolean;
}

interface NewGitHubAppRepoParams {
Expand Down Expand Up @@ -542,7 +542,7 @@ export class ReposList extends React.Component<
{formApi.getFormState().values.type !== 'oci' ? (
<FormField formApi={formApi} label='Enable OCI' field='enableOCI' component={CheckboxField} />
) : (
<FormField formApi={formApi} label='Insecure HTTP Only' field='insecureOCIHttpOnly' component={CheckboxField} />
<FormField formApi={formApi} label='Insecure HTTP Only' field='insecureOCIForceHttp' component={CheckboxField} />
)}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/shared/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ export interface Repository {
enableLfs?: boolean;
githubAppId?: string;
forceHttpBasicAuth?: boolean;
insecureOCIHttpOnly?: boolean;
insecureOCIForceHttp?: boolean;
enableOCI: boolean;
}

Expand Down
6 changes: 3 additions & 3 deletions ui/src/app/shared/services/repo-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class RepositoriesService {
project,
forceHttpBasicAuth,
enableOCI,
insecureOCIHttpOnly
insecureOCIForceHttp
}: {
type: string;
name: string;
Expand All @@ -47,7 +47,7 @@ export class RepositoriesService {
project?: string;
forceHttpBasicAuth?: boolean;
enableOCI: boolean;
insecureOCIHttpOnly: boolean;
insecureOCIForceHttp: boolean;
}): Promise<models.Repository> {
return requests
.post('/repositories')
Expand All @@ -66,7 +66,7 @@ export class RepositoriesService {
project,
forceHttpBasicAuth,
enableOCI,
insecureOCIHttpOnly
insecureOCIForceHttp
})
.then(res => res.body as models.Repository);
}
Expand Down
6 changes: 3 additions & 3 deletions util/db/repository_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ func secretToRepository(secret *corev1.Secret) (*appsv1.Repository, error) {
}
repository.EnableOCI = enableOCI

insecureHttpOnly, err := boolOrFalse(secret, "insecureHttpOnly")
insecureOCIForceHttp, err := boolOrFalse(secret, "insecureOCIForceHttp")
if err != nil {
return repository, err
}
repository.InsecureOCIHttpOnly = insecureHttpOnly
repository.InsecureOCIForceHttp = insecureOCIForceHttp

githubAppID, err := intOrZero(secret, "githubAppID")
if err != nil {
Expand Down Expand Up @@ -380,7 +380,7 @@ func repositoryToSecret(repository *appsv1.Repository, secret *corev1.Secret) {
updateSecretString(secret, "password", repository.Password)
updateSecretString(secret, "sshPrivateKey", repository.SSHPrivateKey)
updateSecretBool(secret, "enableOCI", repository.EnableOCI)
updateSecretBool(secret, "insecureHttpOnly", repository.InsecureOCIHttpOnly)
updateSecretBool(secret, "insecureOCIForceHttp", repository.InsecureOCIForceHttp)
updateSecretString(secret, "tlsClientCertData", repository.TLSClientCertData)
updateSecretString(secret, "tlsClientCertKey", repository.TLSClientCertKey)
updateSecretString(secret, "type", repository.Type)
Expand Down

0 comments on commit 142584f

Please sign in to comment.