Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed metrics credentials and upload metrics if they are present #5157

Merged
merged 3 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ docs/themes
docs/package-lock.json
pkg/skaffold/color/debug.test
cmd/skaffold/app/cmd/statik/statik.go
cmd/skaffold/app/secret/statik/statik.go
32 changes: 1 addition & 31 deletions cmd/skaffold/app/cmd/schema/print_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,15 @@ package schema

import (
"bytes"
"io"
"net/http"
"os"
"testing"

"github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/cmd/statik"
"github.com/GoogleContainerTools/skaffold/testutil"
)

type fakeFileSystem struct {
Files map[string][]byte
}

type fakeFile struct {
http.File
content io.Reader
}

func (f *fakeFileSystem) Open(name string) (http.File, error) {
content, found := f.Files[name]
if !found {
return nil, os.ErrNotExist
}

return &fakeFile{
content: bytes.NewBuffer(content),
}, nil
}

func (f *fakeFile) Read(p []byte) (n int, err error) {
return f.content.Read(p)
}

func (f *fakeFile) Close() error {
return nil
}

func TestPrint(t *testing.T) {
fs := &fakeFileSystem{
fs := &testutil.FakeFileSystem{
Files: map[string][]byte{
"/schemas/v1.json": []byte("{SCHEMA}"),
},
Expand Down
17 changes: 17 additions & 0 deletions cmd/skaffold/app/secret/statik/fs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright 2020 The Skaffold 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 statik
16 changes: 11 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ replace (

require (
4d63.com/tz v1.1.0
cloud.google.com/go v0.72.0 // indirect
cloud.google.com/go/storage v1.10.0
github.com/AlecAivazis/survey/v2 v2.0.5
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.13.0
github.com/Microsoft/go-winio v0.4.15 // indirect
github.com/blang/semver v3.5.1+incompatible
github.com/bmatcuk/doublestar v1.2.4
Expand All @@ -37,7 +39,7 @@ require (
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
github.com/golang/protobuf v1.4.3
github.com/google/go-cmp v0.5.2
github.com/google/go-cmp v0.5.4
github.com/google/go-containerregistry v0.1.4
github.com/google/go-github v17.0.0+incompatible
github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible // indirect
Expand Down Expand Up @@ -67,15 +69,19 @@ require (
github.com/tektoncd/pipeline v0.5.1-0.20190731183258-9d7e37e85bf8
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9
go.opentelemetry.io/otel v0.13.0
go.opentelemetry.io/otel/sdk v0.13.0
golang.org/x/mod v0.3.0
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb // indirect
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221
gomodules.xyz/jsonpatch/v2 v2.1.0 // indirect
google.golang.org/api v0.34.0
google.golang.org/genproto v0.0.0-20201022181438-0ff5f38871d5
google.golang.org/grpc v1.33.1
google.golang.org/api v0.35.0
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20201202151023-55d61f90c1ce
google.golang.org/grpc v1.33.2
gopkg.in/AlecAivazis/survey.v1 v1.8.8
gopkg.in/yaml.v2 v2.3.0
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
Expand Down
54 changes: 54 additions & 0 deletions go.sum

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions hack/generate-statik.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set -euo pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

SECRET=${SECRET:-${DIR}/../secrets}
BIN=${DIR}/bin
STATIK=${BIN}/statik
LICENSES=${BIN}/go-licenses
Expand Down Expand Up @@ -54,3 +55,8 @@ if ! [[ -f ${STATIK} ]]; then
fi

${STATIK} -f -src=${TMP_DIR} -m -dest cmd/skaffold/app/cmd

if [[ -d ${SECRET} ]]; then
echo "generating statik for secret"
${STATIK} -f -src=${SECRET} -m -dest cmd/skaffold/app/secret
fi
Loading