Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
e74772f1
Commit
e74772f1
authored
Mar 01, 2017
by
Matt Butcher
Committed by
GitHub
Mar 01, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2021 from technosophos/feat/2019-dep-up-skip-refresh
feat(helm): add --skip-refresh flag to 'helm dep up'
parents
12478308
f7b010a1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
1 deletion
+56
-1
dependency_update.go
cmd/helm/dependency_update.go
+3
-0
dependency_update_test.go
cmd/helm/dependency_update_test.go
+44
-0
manager.go
pkg/downloader/manager.go
+9
-1
No files found.
cmd/helm/dependency_update.go
View file @
e74772f1
...
...
@@ -46,6 +46,7 @@ type dependencyUpdateCmd struct {
helmhome
helmpath
.
Home
verify
bool
keyring
string
skipRefresh
bool
}
// newDependencyUpdateCmd creates a new dependency update command.
...
...
@@ -80,6 +81,7 @@ func newDependencyUpdateCmd(out io.Writer) *cobra.Command {
f
:=
cmd
.
Flags
()
f
.
BoolVar
(
&
duc
.
verify
,
"verify"
,
false
,
"verify the packages against signatures"
)
f
.
StringVar
(
&
duc
.
keyring
,
"keyring"
,
defaultKeyring
(),
"keyring containing public keys"
)
f
.
BoolVar
(
&
duc
.
skipRefresh
,
"skip-refresh"
,
false
,
"do not refresh the local repository cache"
)
return
cmd
}
...
...
@@ -91,6 +93,7 @@ func (d *dependencyUpdateCmd) run() error {
ChartPath
:
d
.
chartpath
,
HelmHome
:
d
.
helmhome
,
Keyring
:
d
.
keyring
,
SkipUpdate
:
d
.
skipRefresh
,
}
if
d
.
verify
{
man
.
Verify
=
downloader
.
VerifyIfPossible
...
...
cmd/helm/dependency_update_test.go
View file @
e74772f1
...
...
@@ -128,6 +128,50 @@ func TestDependencyUpdateCmd(t *testing.T) {
}
}
func
TestDependencyUpdateCmd_SkipRefresh
(
t
*
testing
.
T
)
{
// Set up a testing helm home
oldhome
:=
helmHome
hh
,
err
:=
tempHelmHome
(
t
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
helmHome
=
hh
defer
func
()
{
os
.
RemoveAll
(
hh
)
helmHome
=
oldhome
}()
srv
:=
repotest
.
NewServer
(
hh
)
defer
srv
.
Stop
()
copied
,
err
:=
srv
.
CopyCharts
(
"testdata/testcharts/*.tgz"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
t
.
Logf
(
"Copied charts:
\n
%s"
,
strings
.
Join
(
copied
,
"
\n
"
))
t
.
Logf
(
"Listening on directory %s"
,
srv
.
Root
())
chartname
:=
"depup"
if
err
:=
createTestingChart
(
hh
,
chartname
,
srv
.
URL
());
err
!=
nil
{
t
.
Fatal
(
err
)
}
out
:=
bytes
.
NewBuffer
(
nil
)
duc
:=
&
dependencyUpdateCmd
{
out
:
out
}
duc
.
helmhome
=
helmpath
.
Home
(
hh
)
duc
.
chartpath
=
filepath
.
Join
(
hh
,
chartname
)
duc
.
skipRefresh
=
true
if
err
:=
duc
.
run
();
err
==
nil
{
t
.
Fatal
(
"Expected failure to find the repo with skipRefresh"
)
}
output
:=
out
.
String
()
// This is written directly to stdout, so we have to capture as is.
if
strings
.
Contains
(
output
,
`update from the "test" chart repository`
)
{
t
.
Errorf
(
"Repo was unexpectedly updated
\n
%s"
,
output
)
}
}
// createTestingChart creates a basic chart that depends on reqtest-0.1.0
//
// The baseURL can be used to point to a particular repository server.
...
...
pkg/downloader/manager.go
View file @
e74772f1
...
...
@@ -53,11 +53,15 @@ type Manager struct {
Verify
VerificationStrategy
// Keyring is the key ring file.
Keyring
string
// SkipUpdate indicates that the repository should not be updated first.
SkipUpdate
bool
}
// Build rebuilds a local charts directory from a lockfile.
//
// If the lockfile is not present, this will run a Manager.Update()
//
// If SkipUpdate is set, this will not update the repository.
func
(
m
*
Manager
)
Build
()
error
{
c
,
err
:=
m
.
loadChartDir
()
if
err
!=
nil
{
...
...
@@ -85,10 +89,12 @@ func (m *Manager) Build() error {
return
err
}
if
!
m
.
SkipUpdate
{
// For each repo in the file, update the cached copy of that repo
if
err
:=
m
.
UpdateRepositories
();
err
!=
nil
{
return
err
}
}
// Now we need to fetch every package here into charts/
if
err
:=
m
.
downloadAll
(
lock
.
Dependencies
);
err
!=
nil
{
...
...
@@ -102,7 +108,7 @@ func (m *Manager) Build() error {
//
// It first reads the requirements.yaml file, and then attempts to
// negotiate versions based on that. It will download the versions
// from remote chart repositories.
// from remote chart repositories
unless SkipUpdate is true
.
func
(
m
*
Manager
)
Update
()
error
{
c
,
err
:=
m
.
loadChartDir
()
if
err
!=
nil
{
...
...
@@ -127,9 +133,11 @@ func (m *Manager) Update() error {
}
// For each repo in the file, update the cached copy of that repo
if
!
m
.
SkipUpdate
{
if
err
:=
m
.
UpdateRepositories
();
err
!=
nil
{
return
err
}
}
// Now we need to find out which version of a chart best satisfies the
// requirements the requirements.yaml
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment