Skip to content

Commit

Permalink
Fix backup Makefile and auth (knative#342)
Browse files Browse the repository at this point in the history
* Fix backup Makefile and auth

Apparently "works on my machine" isn't enough.

1. The Makefile was broken, use the current directory for the build
context.
2. Activate the service account (not necessary for gcrane, but necessary
for gsutil).

* Get service account key from env

* For backup image, pass keyfile as first argument
  • Loading branch information
jonjohnsonjr authored and knative-prow-robot committed Dec 20, 2018
1 parent 9238c6e commit 42b5742
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion ci/prow/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,9 @@ periodics:
imagePullPolicy: Always
command:
- "/backup.sh"

args:
- "/etc/backup-account/service-account.json"

postsubmits:
knative/serving:
- name: post-knative-serving-go-coverage
Expand Down
4 changes: 1 addition & 3 deletions images/backups/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@ LABEL maintainer "Jon Johnson <jonjohnson@google.com>"
COPY --from=gcrane /ko-app /bin/gcrane

# Copy the entrypoint shell script.
COPY . .

ENTRYPOINT ["/backup.sh"]
ADD . .
2 changes: 1 addition & 1 deletion images/backups/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TAG := $(shell date +v%Y%m%d)-$(shell git describe --always --dirty --match '^$$
all: build

build:
docker build -t $(IMG):$(TAG) -f Dockerfile ../..
docker build -t $(IMG):$(TAG) -f Dockerfile .
docker tag $(IMG):$(TAG) $(IMG):latest

push_versioned: build
Expand Down
3 changes: 3 additions & 0 deletions images/backups/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
# This is a script to backup knative released images and yaml to the
# knative-backups project.

echo "Activating service account"
gcloud auth activate-service-account --key-file=$1

echo "Copying images"
gcrane cp -r gcr.io/knative-releases gcr.io/knative-backups

Expand Down

0 comments on commit 42b5742

Please sign in to comment.