mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-19 02:01:43 +02:00
Updated vendor to get container-diff master
This commit is contained in:
+45
-7
@@ -22,6 +22,7 @@ import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/containers/image/manifest"
|
||||
@@ -119,7 +120,7 @@ func gzipBytes(b []byte) ([]byte, error) {
|
||||
}
|
||||
|
||||
// appendLayer appends an uncompressed blob to the image, preserving the invariants required across the config and manifest.
|
||||
func (m *MutableSource) AppendLayer(content []byte) error {
|
||||
func (m *MutableSource) AppendLayer(content []byte, author string) error {
|
||||
compressedBlob, err := gzipBytes(content)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -141,12 +142,7 @@ func (m *MutableSource) AppendLayer(content []byte) error {
|
||||
// Also add it to the config.
|
||||
diffID := digest.FromBytes(content)
|
||||
m.cfg.RootFS.DiffIDs = append(m.cfg.RootFS.DiffIDs, diffID)
|
||||
history := manifest.Schema2History{
|
||||
Created: time.Now(),
|
||||
Author: "container-diff",
|
||||
}
|
||||
m.cfg.History = append(m.cfg.History, history)
|
||||
|
||||
m.appendConfigHistory(author, false)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -166,3 +162,45 @@ func (m *MutableSource) saveConfig() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Env returns a map of environment variables stored in the image config
|
||||
// Converts each variable from a string of the form KEY=VALUE to a map of KEY:VALUE
|
||||
func (m *MutableSource) Env() map[string]string {
|
||||
envArray := m.cfg.Schema2V1Image.Config.Env
|
||||
envMap := make(map[string]string)
|
||||
for _, env := range envArray {
|
||||
entry := strings.Split(env, "=")
|
||||
envMap[entry[0]] = entry[1]
|
||||
}
|
||||
return envMap
|
||||
}
|
||||
|
||||
// SetEnv takes a map of environment variables, and converts them to an array of strings
|
||||
// in the form KEY=VALUE, and then sets the image config
|
||||
func (m *MutableSource) SetEnv(envMap map[string]string, author string) {
|
||||
envArray := []string{}
|
||||
for key, value := range envMap {
|
||||
entry := key + "=" + value
|
||||
envArray = append(envArray, entry)
|
||||
}
|
||||
m.cfg.Schema2V1Image.Config.Env = envArray
|
||||
m.appendConfigHistory(author, true)
|
||||
}
|
||||
|
||||
func (m *MutableSource) Config() *manifest.Schema2Config {
|
||||
return m.cfg.Schema2V1Image.Config
|
||||
}
|
||||
|
||||
func (m *MutableSource) SetConfig(config *manifest.Schema2Config, author string, emptyLayer bool) {
|
||||
m.cfg.Schema2V1Image.Config = config
|
||||
m.appendConfigHistory(author, emptyLayer)
|
||||
}
|
||||
|
||||
func (m *MutableSource) appendConfigHistory(author string, emptyLayer bool) {
|
||||
history := manifest.Schema2History{
|
||||
Created: time.Now(),
|
||||
Author: author,
|
||||
EmptyLayer: emptyLayer,
|
||||
}
|
||||
m.cfg.History = append(m.cfg.History, history)
|
||||
}
|
||||
|
||||
+6
@@ -462,6 +462,12 @@ type store struct {
|
||||
// GetStore attempts to find an already-created Store object matching the
|
||||
// specified location and graph driver, and if it can't, it creates and
|
||||
// initializes a new Store object, and the underlying storage that it controls.
|
||||
//
|
||||
// If StoreOptions `options` haven't been fully populated, then DefaultStoreOptions are used.
|
||||
//
|
||||
// These defaults observe environment variables:
|
||||
// * `STORAGE_DRIVER` for the name of the storage driver to attempt to use
|
||||
// * `STORAGE_OPTS` for the string of options to pass to the driver
|
||||
func GetStore(options StoreOptions) (Store, error) {
|
||||
if options.RunRoot == "" && options.GraphRoot == "" && options.GraphDriverName == "" && len(options.GraphDriverOptions) == 0 {
|
||||
options = DefaultStoreOptions
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ const (
|
||||
|
||||
// The Content-Type values for the different wire protocols.
|
||||
FmtUnknown Format = `<unknown>`
|
||||
FmtText Format = `text/plain; version=` + TextVersion
|
||||
FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8`
|
||||
FmtProtoDelim Format = ProtoFmt + ` encoding=delimited`
|
||||
FmtProtoText Format = ProtoFmt + ` encoding=text`
|
||||
FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text`
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
/usr/bin/vim
|
||||
-1
@@ -1 +0,0 @@
|
||||
../../symlinktargets/abc
|
||||
-1
@@ -1 +0,0 @@
|
||||
../../symlinktargets/def
|
||||
-1
@@ -1 +0,0 @@
|
||||
../../symlinktargets/xyz
|
||||
-1
@@ -1 +0,0 @@
|
||||
../../symlinktargets/ghi
|
||||
-1
@@ -1 +0,0 @@
|
||||
../../symlinktargets/uvw
|
||||
-1
@@ -1 +0,0 @@
|
||||
mnt:[4026531840]
|
||||
-1
@@ -1 +0,0 @@
|
||||
net:[4026531993]
|
||||
-1
@@ -1 +0,0 @@
|
||||
../../symlinktargets/abc
|
||||
-1
@@ -1 +0,0 @@
|
||||
../../symlinktargets/def
|
||||
-1
@@ -1 +0,0 @@
|
||||
../../symlinktargets/ghi
|
||||
-1
@@ -1 +0,0 @@
|
||||
../../symlinktargets/uvw
|
||||
-1
@@ -1 +0,0 @@
|
||||
../../symlinktargets/xyz
|
||||
-1
@@ -1 +0,0 @@
|
||||
26231
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
// While implementing parsing of /proc/[pid]/mountstats, this blog was used
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
|
||||
+15
-1
@@ -1,6 +1,20 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@@ -113,7 +127,7 @@ func (p Proc) CmdLine() ([]string, error) {
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
return strings.Split(string(data[:len(data)-1]), string(byte(0))), nil
|
||||
return strings.Split(string(bytes.TrimRight(data, string("\x00"))), string(byte(0))), nil
|
||||
}
|
||||
|
||||
// Comm returns the command name of a process.
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user