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
b8f8efc6
Commit
b8f8efc6
authored
Sep 15, 2016
by
Matt Butcher
Committed by
GitHub
Sep 15, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1202 from philips/use-digest-format
feat(repo): use OCI style digest identifiers
parents
3c338ee6
440e5489
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
17 deletions
+15
-17
chart_repository.md
docs/chart_repository.md
+2
-2
index.go
pkg/repo/index.go
+1
-1
repo.go
pkg/repo/repo.go
+10
-12
repo_test.go
pkg/repo/repo_test.go
+2
-2
No files found.
docs/chart_repository.md
View file @
b8f8efc6
...
@@ -23,7 +23,7 @@ alpine-0.1.0:
...
@@ -23,7 +23,7 @@ alpine-0.1.0:
name: alpine
name: alpine
url: https://storage.googleapis.com/kubernetes-charts/alpine-0.1.0.tgz
url: https://storage.googleapis.com/kubernetes-charts/alpine-0.1.0.tgz
created: 2016-05-26 11:23:44.086354411 +0000 UTC
created: 2016-05-26 11:23:44.086354411 +0000 UTC
checksum: a61575c2d3160e5e39abf2a5ec984d6119404b18
digest: sha256:78e9a4282295184e8ce1496d23987993673f38e33e203c8bc18bc838a73e5864
chartfile:
chartfile:
name: alpine
name: alpine
description: Deploy a basic Alpine Linux pod
description: Deploy a basic Alpine Linux pod
...
@@ -33,7 +33,7 @@ redis-2.0.0:
...
@@ -33,7 +33,7 @@ redis-2.0.0:
name: redis
name: redis
url: https://storage.googleapis.com/kubernetes-charts/redis-2.0.0.tgz
url: https://storage.googleapis.com/kubernetes-charts/redis-2.0.0.tgz
created: 2016-05-26 11:23:44.087939192 +0000 UTC
created: 2016-05-26 11:23:44.087939192 +0000 UTC
checksum: 2cea3048cf85d588204e1b1cc0674472b4517919
digest: sha256:bde9c2949e64d059c18d8f93566a64dafc6d2e8e259a70322fb804831dfd0b5b
chartfile:
chartfile:
name: redis
name: redis
description: Port of the replicatedservice template from kubernetes/charts
description: Port of the replicatedservice template from kubernetes/charts
...
...
pkg/repo/index.go
View file @
b8f8efc6
...
@@ -39,7 +39,7 @@ type ChartRef struct {
...
@@ -39,7 +39,7 @@ type ChartRef struct {
URL
string
`yaml:"url"`
URL
string
`yaml:"url"`
Created
string
`yaml:"created,omitempty"`
Created
string
`yaml:"created,omitempty"`
Removed
bool
`yaml:"removed,omitempty"`
Removed
bool
`yaml:"removed,omitempty"`
Checksum
string
`yaml:"checksum
,omitempty"`
Digest
string
`yaml:"digest
,omitempty"`
Chartfile
*
chart
.
Metadata
`yaml:"chartfile"`
Chartfile
*
chart
.
Metadata
`yaml:"chartfile"`
}
}
...
...
pkg/repo/repo.go
View file @
b8f8efc6
...
@@ -17,9 +17,10 @@ limitations under the License.
...
@@ -17,9 +17,10 @@ limitations under the License.
package
repo
// import "k8s.io/helm/pkg/repo"
package
repo
// import "k8s.io/helm/pkg/repo"
import
(
import
(
"crypto/sha1"
"crypto/sha256"
"encoding/hex"
"errors"
"errors"
"
fmt
"
"
io
"
"io/ioutil"
"io/ioutil"
"net/url"
"net/url"
"os"
"os"
...
@@ -131,7 +132,7 @@ func (r *ChartRepository) Index() error {
...
@@ -131,7 +132,7 @@ func (r *ChartRepository) Index() error {
}
}
chartfile
:=
ch
.
Metadata
chartfile
:=
ch
.
Metadata
hash
,
err
:=
generateChecksum
(
path
)
digest
,
err
:=
generateDigest
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -152,7 +153,7 @@ func (r *ChartRepository) Index() error {
...
@@ -152,7 +153,7 @@ func (r *ChartRepository) Index() error {
url
,
_
:=
url
.
Parse
(
r
.
URL
)
url
,
_
:=
url
.
Parse
(
r
.
URL
)
url
.
Path
=
filepath
.
Join
(
url
.
Path
,
key
+
".tgz"
)
url
.
Path
=
filepath
.
Join
(
url
.
Path
,
key
+
".tgz"
)
entry
:=
&
ChartRef
{
Chartfile
:
chartfile
,
Name
:
chartfile
.
Name
,
URL
:
url
.
String
(),
Created
:
created
,
Checksum
:
hash
,
Removed
:
false
}
entry
:=
&
ChartRef
{
Chartfile
:
chartfile
,
Name
:
chartfile
.
Name
,
URL
:
url
.
String
(),
Created
:
created
,
Digest
:
digest
,
Removed
:
false
}
r
.
IndexFile
.
Entries
[
key
]
=
entry
r
.
IndexFile
.
Entries
[
key
]
=
entry
...
@@ -170,18 +171,15 @@ func (r *ChartRepository) Index() error {
...
@@ -170,18 +171,15 @@ func (r *ChartRepository) Index() error {
return
r
.
saveIndexFile
()
return
r
.
saveIndexFile
()
}
}
func
generate
Checksum
(
path
string
)
(
string
,
error
)
{
func
generate
Digest
(
path
string
)
(
string
,
error
)
{
f
,
err
:=
os
.
Open
(
path
)
f
,
err
:=
os
.
Open
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
b
,
err
:=
ioutil
.
ReadAll
(
f
)
h
:=
sha256
.
New
()
if
err
!=
nil
{
io
.
Copy
(
h
,
f
)
return
""
,
err
}
result
:=
sha1
.
Sum
(
b
)
return
fmt
.
Sprintf
(
"%x"
,
result
),
nil
digest
:=
h
.
Sum
([]
byte
{})
return
"sha256:"
+
hex
.
EncodeToString
(
digest
[
:
]),
nil
}
}
pkg/repo/repo_test.go
View file @
b8f8efc6
...
@@ -85,8 +85,8 @@ func TestIndex(t *testing.T) {
...
@@ -85,8 +85,8 @@ func TestIndex(t *testing.T) {
}
}
timestamps
[
chartName
]
=
details
.
Created
timestamps
[
chartName
]
=
details
.
Created
if
details
.
Checksum
==
""
{
if
details
.
Digest
==
""
{
t
.
Errorf
(
"
Checksum
was not set for %s"
,
chartName
)
t
.
Errorf
(
"
Digest
was not set for %s"
,
chartName
)
}
}
}
}
...
...
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