Skip to content

Commit

Permalink
chore: lint and rename
Browse files Browse the repository at this point in the history
Signed-off-by: Blake Pettersson <[email protected]>
  • Loading branch information
blakepettersson committed Oct 3, 2024
1 parent 2e7848c commit 7243332
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 42 deletions.
2 changes: 1 addition & 1 deletion docs/operator-manual/server-commands/argocd-repo-server.md

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

4 changes: 2 additions & 2 deletions reposerver/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -2383,7 +2383,7 @@ func (s *Service) GetRevisionMetadata(ctx context.Context, q *apiclient.RepoServ
}

func (s *Service) GetOCIMetadata(ctx context.Context, q *apiclient.RepoServerRevisionChartDetailsRequest) (*v1alpha1.OCIMetadata, error) {
client, err := s.newOCIClient(q.Repo.Repo, q.Repo.GetOCICreds(), q.Repo.Proxy, q.Repo.NoProxy, s.initConstants.OCIMediaTypes, oci.WithIndexCache(s.cache), oci.WithChartPaths(s.chartPaths))
client, err := s.newOCIClient(q.Repo.Repo, q.Repo.GetOCICreds(), q.Repo.Proxy, q.Repo.NoProxy, s.initConstants.OCIMediaTypes, oci.WithIndexCache(s.cache), oci.WithImagePaths(s.chartPaths))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -2481,7 +2481,7 @@ func (s *Service) newClientResolveRevision(repo *v1alpha1.Repository, revision s
}

func (s *Service) newOCIClientResolveRevision(ctx context.Context, repo *v1alpha1.Repository, revision string, noRevisionCache bool) (oci.Client, string, error) {
ociClient, err := s.newOCIClient(repo.Repo, repo.GetOCICreds(), repo.Proxy, repo.NoProxy, s.initConstants.OCIMediaTypes, oci.WithIndexCache(s.cache), oci.WithChartPaths(s.chartPaths))
ociClient, err := s.newOCIClient(repo.Repo, repo.GetOCICreds(), repo.Proxy, repo.NoProxy, s.initConstants.OCIMediaTypes, oci.WithIndexCache(s.cache), oci.WithImagePaths(s.chartPaths))
if err != nil {
return nil, "", err
}
Expand Down
50 changes: 16 additions & 34 deletions ui/src/app/settings/components/repos-list/repos-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,10 @@ export class ReposList extends React.Component<
/>
</div>
<div className='argo-form-row'>
<FormField formApi={formApi} label='Repository URL' field='url'
component={Text}/>
<FormField formApi={formApi} label='Repository URL' field='url' component={Text} />
</div>
<div className='argo-form-row'>
<FormField formApi={formApi} label='Username (optional)'
field='username' component={Text}/>
<FormField formApi={formApi} label='Username (optional)' field='username' component={Text} />
</div>
<div className='argo-form-row'>
<FormField
Expand All @@ -514,54 +512,38 @@ export class ReposList extends React.Component<
/>
</div>
<div className='argo-form-row'>
<FormField formApi={formApi}
label='TLS client certificate (optional)'
field='tlsClientCertData' component={TextArea}/>
<FormField formApi={formApi} label='TLS client certificate (optional)' field='tlsClientCertData' component={TextArea} />
</div>
<div className='argo-form-row'>
<FormField formApi={formApi}
label='TLS client certificate key (optional)'
field='tlsClientCertKey' component={TextArea}/>
<FormField formApi={formApi} label='TLS client certificate key (optional)' field='tlsClientCertKey' component={TextArea} />
</div>
{formApi.getFormState().values.type === 'git' && (
<React.Fragment>
<div className='argo-form-row'>
<FormField formApi={formApi}
label='Skip server verification'
field='insecure' component={CheckboxField}/>
<HelpIcon
title='This setting is ignored when creating as credential template.'/>
<FormField formApi={formApi} label='Skip server verification' field='insecure' component={CheckboxField} />
<HelpIcon title='This setting is ignored when creating as credential template.' />
</div>
<div className='argo-form-row'>
<FormField formApi={formApi}
label='Force HTTP basic auth'
field='forceHttpBasicAuth'
component={CheckboxField}/>
<FormField formApi={formApi} label='Force HTTP basic auth' field='forceHttpBasicAuth' component={CheckboxField} />
</div>
<div className='argo-form-row'>
<FormField formApi={formApi}
label='Enable LFS support (Git only)'
field='enableLfs' component={CheckboxField}/>
<HelpIcon
title='This setting is ignored when creating as credential template.'/>
<FormField formApi={formApi} label='Enable LFS support (Git only)' field='enableLfs' component={CheckboxField} />
<HelpIcon title='This setting is ignored when creating as credential template.' />
</div>
</React.Fragment>
)}
<div className='argo-form-row'>
<FormField formApi={formApi} label='Proxy (optional)'
field='proxy' component={Text}/>
<FormField formApi={formApi} label='Proxy (optional)' field='proxy' component={Text} />
</div>
<div className='argo-form-row'>
<FormField formApi={formApi} label='NoProxy (optional)'
field='noProxy' component={Text}/>
<FormField formApi={formApi} label='NoProxy (optional)' field='noProxy' component={Text} />
</div>
<div className='argo-form-row'>
{formApi.getFormState().values.type !== 'oci' ?
<FormField formApi={formApi} label='Enable OCI'
field='enableOCI' component={CheckboxField}/>
: <FormField formApi={formApi} label='Insecure HTTP Only'
field='insecureHttpOnly'
component={CheckboxField}/>}
{formApi.getFormState().values.type !== 'oci' ? (
<FormField formApi={formApi} label='Enable OCI' field='enableOCI' component={CheckboxField} />
) : (
<FormField formApi={formApi} label='Insecure HTTP Only' field='insecureHttpOnly' component={CheckboxField} />
)}
</div>
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion util/oci/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func WithIndexCache(indexCache indexCache) ClientOpts {
}
}

func WithChartPaths(repoCachePaths argoio.TempPaths) ClientOpts {
func WithImagePaths(repoCachePaths argoio.TempPaths) ClientOpts {
return func(c *nativeOCIClient) {
c.repoCachePaths = repoCachePaths
}
Expand Down
10 changes: 6 additions & 4 deletions util/oci/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"path/filepath"
"testing"

"github.com/argoproj/argo-cd/v2/util/io/files"
"github.com/opencontainers/go-digest"
"github.com/opencontainers/image-spec/specs-go"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
Expand All @@ -23,6 +22,7 @@ import (
"oras.land/oras-go/v2/content/memory"

argoio "github.com/argoproj/argo-cd/v2/util/io"
"github.com/argoproj/argo-cd/v2/util/io/files"
)

type layerConf struct {
Expand Down Expand Up @@ -179,9 +179,11 @@ func Test_nativeOCIClient_Extract(t *testing.T) {
require.Len(t, chartDir, 1)
require.Equal(t, "chart.tar.gz", chartDir[0].Name())
tarBall, err := os.Open(filepath.Join(path, chartDir[0].Name()))
require.NoError(t, err)
err = files.Untgz(tempDir, tarBall, math.MaxInt64, false)
require.NoError(t, err)
unpacked, err := os.ReadDir(tempDir)
require.NoError(t, err)
require.Len(t, unpacked, 1)
require.Equal(t, "Chart.yaml", unpacked[0].Name())
chartYaml, err := os.Open(filepath.Join(tempDir, unpacked[0].Name()))
Expand Down Expand Up @@ -233,7 +235,7 @@ func Test_nativeOCIClient_Extract(t *testing.T) {
disableManifestMaxExtractedSize: false,
postValidationFunc: func(sha string, _ string, _ Client, fields fields, args args) {
store := memory.New()
c := newClientWithLock(fields.repoURL, fields.creds, globalLock, store, fields.tagsFunc, fields.allowedMediaTypes, WithChartPaths(cacheDir))
c := newClientWithLock(fields.repoURL, fields.creds, globalLock, store, fields.tagsFunc, fields.allowedMediaTypes, WithImagePaths(cacheDir))
_, gotCloser, err := c.Extract(context.Background(), sha, args.project, args.manifestMaxExtractedSize, args.disableManifestMaxExtractedSize)
require.NoError(t, err)
require.NoError(t, gotCloser.Close())
Expand All @@ -254,7 +256,7 @@ func Test_nativeOCIClient_Extract(t *testing.T) {
disableManifestMaxExtractedSize: false,
postValidationFunc: func(sha string, _ string, _ Client, fields fields, args args) {
store := memory.New()
c := newClientWithLock(fields.repoURL, fields.creds, globalLock, store, fields.tagsFunc, fields.allowedMediaTypes, WithChartPaths(cacheDir))
c := newClientWithLock(fields.repoURL, fields.creds, globalLock, store, fields.tagsFunc, fields.allowedMediaTypes, WithImagePaths(cacheDir))
_, _, err := c.Extract(context.Background(), sha, "non-existent-project", args.manifestMaxExtractedSize, args.disableManifestMaxExtractedSize)
require.Error(t, err)
require.Equal(t, fmt.Errorf("not found"), err)
Expand All @@ -271,7 +273,7 @@ func Test_nativeOCIClient_Extract(t *testing.T) {
tt.args.project = tt.name
}

c := newClientWithLock(tt.fields.repoURL, tt.fields.creds, globalLock, store, tt.fields.tagsFunc, tt.fields.allowedMediaTypes, WithChartPaths(cacheDir))
c := newClientWithLock(tt.fields.repoURL, tt.fields.creds, globalLock, store, tt.fields.tagsFunc, tt.fields.allowedMediaTypes, WithImagePaths(cacheDir))
path, gotCloser, err := c.Extract(context.Background(), sha, tt.args.project, tt.args.manifestMaxExtractedSize, tt.args.disableManifestMaxExtractedSize)

if tt.expectedError != nil {
Expand Down

0 comments on commit 7243332

Please sign in to comment.