From 2301b8f44fbf91f805948d1ac373e33dd464fabb Mon Sep 17 00:00:00 2001
From: Marco Schmidt <marcog.schmidt@gmail.com>
Date: Tue, 13 Aug 2019 15:29:50 -0400
Subject: [PATCH] Add credentials to push to private docker repo (#4)

* Add credentials to push to private docker repo
* Small cloudbuild correction
---
 changelog/v0.0.1/add-ci.yaml               |  6 +++---
 changelog/v0.0.1/add-quay-permissions.yaml |  3 +++
 cloudbuild.yaml                            | 13 ++++++++++++-
 3 files changed, 18 insertions(+), 4 deletions(-)
 create mode 100644 changelog/v0.0.1/add-quay-permissions.yaml

diff --git a/changelog/v0.0.1/add-ci.yaml b/changelog/v0.0.1/add-ci.yaml
index f99cd2b..6c6d987 100644
--- a/changelog/v0.0.1/add-ci.yaml
+++ b/changelog/v0.0.1/add-ci.yaml
@@ -1,4 +1,4 @@
 changelog:
-  - type: NEW_FEATURE
-    description: Added CI configuration to project.
-    issueLink: https://github.com/solo-io/ext-auth-plugins/issues/2
\ No newline at end of file
+- type: NEW_FEATURE
+  description: Added CI configuration to project.
+  issueLink: https://github.com/solo-io/ext-auth-plugins/issues/2
\ No newline at end of file
diff --git a/changelog/v0.0.1/add-quay-permissions.yaml b/changelog/v0.0.1/add-quay-permissions.yaml
new file mode 100644
index 0000000..80faf5c
--- /dev/null
+++ b/changelog/v0.0.1/add-quay-permissions.yaml
@@ -0,0 +1,3 @@
+changelog:
+- type: NON_USER_FACING
+  description: Added encrypted credentials to push images to private docker repo.
\ No newline at end of file
diff --git a/cloudbuild.yaml b/cloudbuild.yaml
index 320f8fb..bf81dc5 100644
--- a/cloudbuild.yaml
+++ b/cloudbuild.yaml
@@ -38,6 +38,12 @@ steps:
   - 'BUILD_ID=$BUILD_ID'
   dir: './gopath/src/github.com/solo-io/ext-auth-plugins'
 
+- name: 'gcr.io/cloud-builders/docker'
+  entrypoint: 'bash'
+  args: ['-c', 'docker login quay.io --username "solo-io+solobot" --password $$QUAY_IO_PASSWORD']
+  secretEnv: ['QUAY_IO_PASSWORD']
+  id: 'docker-login'
+
 - name: 'gcr.io/$PROJECT_ID/go-make:0.1.12'
   args: ['publish-examples']
   env:
@@ -46,4 +52,9 @@ steps:
   - 'TAGGED_VERSION=$TAG_NAME'
   - 'BUILD_ID=$BUILD_ID'
   dir: './gopath/src/github.com/solo-io/ext-auth-plugins'
-  id: 'publish-examples'
\ No newline at end of file
+  id: 'publish-examples'
+
+secrets:
+- kmsKeyName: projects/solo-public/locations/global/keyRings/build/cryptoKeys/build-key
+  secretEnv:
+    QUAY_IO_PASSWORD: CiQABlzmSRx5TcOqbldXa/d/+bkmAfpNAWa3PTS06WvuloZL+vASaQCCPGSGCogonVZVEUNx4G3YJtWi18gSuNx4PvLe08q8xAflTMFkjsyQirAOK3Y2oCvgYwiw/ITcuydjkpMjxDygFyENXS9FKFJoAXHlPQE5qidKr8xxmxF5ezhmjGB0gjyjXIIkbSEnBg==
\ No newline at end of file