mirror of
https://github.com/gomods/athens
synced 2026-02-03 12:10:32 +00:00
Fixing the build failures from a missing GCS Key (#1480)
* Fixing the build failures from a missing GCS Key Accidentally introduced in https://github.com/gomods/athens/pull/1428 * Adding a TODO to the drone build * adding a step to test the Athens server startup * Adding the JSONKey back to the default config * use temporary image * Switching back to the old env var for the GCS JSON Key cc/ @marwan-at-work * removing the ServiceAccount. we want to stick with JSONKey * reverting to original key fetching code * fixing build err * bumping chart ver
This commit is contained in:
committed by
GitHub
parent
e0ec46b221
commit
707b7b5413
+2
-1
@@ -33,6 +33,7 @@ steps:
|
|||||||
# end to end test
|
# end to end test
|
||||||
- ./main & # run the just-built athens server
|
- ./main & # run the just-built athens server
|
||||||
- sleep 3 # wait for it to spin up
|
- sleep 3 # wait for it to spin up
|
||||||
|
- curl localhost:3000
|
||||||
- mkdir -p ~/happy
|
- mkdir -p ~/happy
|
||||||
- mkdir -p ~/emptygopath # ensure the gopath has no modules cached.
|
- mkdir -p ~/emptygopath # ensure the gopath has no modules cached.
|
||||||
- cd ~/happy
|
- cd ~/happy
|
||||||
@@ -153,7 +154,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 6379
|
- 6379
|
||||||
- name: athens-proxy
|
- name: athens-proxy
|
||||||
image: gomods/athens:canary
|
image: gomods/athens-dev:221c451 # temporary to make the build pass, revert to gomods/athens:canary after merge.
|
||||||
pull: always
|
pull: always
|
||||||
ports:
|
ports:
|
||||||
- 3000
|
- 3000
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: athens-proxy
|
name: athens-proxy
|
||||||
version: 0.4.0
|
version: 0.4.1
|
||||||
appVersion: 0.7.0
|
appVersion: 0.7.0
|
||||||
description: The proxy server for Go modules
|
description: The proxy server for Go modules
|
||||||
icon: https://raw.githubusercontent.com/gomods/athens/master/docs/static/banner.png
|
icon: https://raw.githubusercontent.com/gomods/athens/master/docs/static/banner.png
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ spec:
|
|||||||
- name: ATHENS_STORAGE_GCP_BUCKET
|
- name: ATHENS_STORAGE_GCP_BUCKET
|
||||||
value: {{ .Values.storage.gcp.bucket | quote }}
|
value: {{ .Values.storage.gcp.bucket | quote }}
|
||||||
{{- if .Values.storage.gcp.serviceAccount }}
|
{{- if .Values.storage.gcp.serviceAccount }}
|
||||||
- name: ATHENS_STORAGE_GCP_SERVICE_ACCOUNT
|
- name: ATHENS_STORAGE_GCP_JSON_KEY
|
||||||
value: {{ .Values.storage.gcp.serviceAccount | b64enc | quote }}
|
value: {{ .Values.storage.gcp.serviceAccount | b64enc | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else if eq .Values.storage.type "minio" }}
|
{{- else if eq .Values.storage.type "minio" }}
|
||||||
|
|||||||
+7
-2
@@ -301,14 +301,19 @@ SingleFlightType = "memory"
|
|||||||
# Env override: ATHENS_STORAGE_GCP_BUCKET
|
# Env override: ATHENS_STORAGE_GCP_BUCKET
|
||||||
Bucket = "MY_GCP_BUCKET"
|
Bucket = "MY_GCP_BUCKET"
|
||||||
|
|
||||||
# ServiceAccount is a base64 encoded service account
|
# JSONKey is a base64 encoded service account
|
||||||
# key that allows Athens to be run outside of GCP
|
# key that allows Athens to be run outside of GCP
|
||||||
# but still be able to access GCS. If you are
|
# but still be able to access GCS. If you are
|
||||||
# running Athens inside GCP, you will most
|
# running Athens inside GCP, you will most
|
||||||
# likely not need this as GCP figures out
|
# likely not need this as GCP figures out
|
||||||
# internal authentication between products for you.
|
# internal authentication between products for you.
|
||||||
|
#
|
||||||
|
# NOTE: This config value is deprecated in favor of
|
||||||
|
# ServiceAccount above. Athens will check for it,
|
||||||
|
# but please do not rely on it being available forever.
|
||||||
|
#
|
||||||
# Env override: ATHENS_STORAGE_GCP_JSON_KEY
|
# Env override: ATHENS_STORAGE_GCP_JSON_KEY
|
||||||
ServiceAccount = ""
|
JSONKey = ""
|
||||||
|
|
||||||
[Storage.Minio]
|
[Storage.Minio]
|
||||||
# Endpoint for Minio storage
|
# Endpoint for Minio storage
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@ package config
|
|||||||
|
|
||||||
// GCPConfig specifies the properties required to use GCP as the storage backend
|
// GCPConfig specifies the properties required to use GCP as the storage backend
|
||||||
type GCPConfig struct {
|
type GCPConfig struct {
|
||||||
ProjectID string `envconfig:"GOOGLE_CLOUD_PROJECT"`
|
ProjectID string `envconfig:"GOOGLE_CLOUD_PROJECT"`
|
||||||
Bucket string `validate:"required" envconfig:"ATHENS_STORAGE_GCP_BUCKET"`
|
Bucket string `validate:"required" envconfig:"ATHENS_STORAGE_GCP_BUCKET"`
|
||||||
ServiceAccount string `envconfig:"ATHENS_STORAGE_GCP_SERVICE_ACCOUNT"`
|
JSONKey string `envconfig:"ATHENS_STORAGE_GCP_JSON_KEY"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ func getTestConfig() *config.GCPConfig {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return &config.GCPConfig{
|
return &config.GCPConfig{
|
||||||
Bucket: "athens_drone_stash_bucket",
|
Bucket: "athens_drone_stash_bucket",
|
||||||
ServiceAccount: creds,
|
JSONKey: creds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ func New(ctx context.Context, gcpConf *config.GCPConfig, timeout time.Duration)
|
|||||||
func newClient(ctx context.Context, gcpConf *config.GCPConfig, timeout time.Duration) (*Storage, error) {
|
func newClient(ctx context.Context, gcpConf *config.GCPConfig, timeout time.Duration) (*Storage, error) {
|
||||||
const op errors.Op = "gcp.newClient"
|
const op errors.Op = "gcp.newClient"
|
||||||
opts := []option.ClientOption{}
|
opts := []option.ClientOption{}
|
||||||
if gcpConf.ServiceAccount != "" {
|
if gcpConf.JSONKey != "" {
|
||||||
key, err := base64.StdEncoding.DecodeString(gcpConf.ServiceAccount)
|
key, err := base64.StdEncoding.DecodeString(gcpConf.JSONKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.E(op, fmt.Errorf("could not decode base64 json key: %v", err))
|
return nil, errors.E(op, fmt.Errorf("could not decode base64 json key: %v", err))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ func getStorage(t testing.TB) *Storage {
|
|||||||
bucketName := randomBucketName(os.Getenv("DRONE_PULL_REQUEST"))
|
bucketName := randomBucketName(os.Getenv("DRONE_PULL_REQUEST"))
|
||||||
cfg := getTestConfig(bucketName)
|
cfg := getTestConfig(bucketName)
|
||||||
if cfg == nil {
|
if cfg == nil {
|
||||||
|
// Don't fail if there's no test config, so that these tests don't
|
||||||
|
// fail when you run them locally
|
||||||
|
t.Log("No GCS Config found")
|
||||||
t.SkipNow()
|
t.SkipNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,9 +75,9 @@ func getTestConfig(bucket string) *config.GCPConfig {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return &config.GCPConfig{
|
return &config.GCPConfig{
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
ServiceAccount: creds,
|
JSONKey: creds,
|
||||||
ProjectID: os.Getenv("GCS_PROJECT_ID"),
|
ProjectID: os.Getenv("GCS_PROJECT_ID"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user