@leverege/build-tools 2.18.0-beta.8 → 2.18.0-pipe.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.18.0-beta.8",
3
+ "version": "2.18.0-pipe.1",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -22,6 +22,7 @@
22
22
  "bin": {
23
23
  "build-tools": "src/build-tools.js",
24
24
  "circleate": "src/circleate",
25
+ "decrypt-env-to-pipeline": "src/decrypt-env-to-pipeline",
25
26
  "decrypt-secrets": "src/decrypt-secrets",
26
27
  "dirty-git": "src/dirty-git",
27
28
  "dockreate": "src/dockreate",
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+
3
+ gcloud --quiet config set project ${GOOGLE_PROJECT}
4
+ gcloud --quiet config set compute/zone ${GOOGLE_COMPUTE_ZONE}
5
+ echo ${GCLOUD_SERVICE_KEY} | gcloud auth activate-service-account --key-file=-
6
+
7
+ # decrypt .env.enc file
8
+ gcloud kms decrypt \
9
+ --project $GOOGLE_PROJECT \
10
+ --key circle-ci \
11
+ --keyring build-tools \
12
+ --location $GOOGLE_COMPUTE_ZONE \
13
+ --plaintext-file .env \
14
+ --ciphertext-file .env.enc
@@ -56,46 +56,16 @@ initialize_gcloud() {
56
56
  gcloud --quiet config set compute/zone ${GOOGLE_COMPUTE_ZONE}
57
57
  }
58
58
 
59
- function decryptEnvToPipeline() {
60
- printf "------------- BitBucket Pipeline Detected -------------\n"
61
- printf " GCLOUD_PROJECT [$GCLOUD_PROJECT]\n"
62
- printf " GCLOUD_COMPUTE_ZONE [$GCLOUD_COMPUTE_ZONE]\n"
63
-
64
- gcloud --quiet config set project ${GCLOUD_PROJECT}
65
- gcloud --quiet config set compute/zone ${GCLOUD_COMPUTE_ZONE}
66
- echo ${GCLOUD_SERVICE_KEY} | gcloud auth activate-service-account --key-file=-
67
-
68
- # decrypt .env.enc file
69
- gcloud kms decrypt \
70
- --project $GCLOUD_PROJECT \
71
- --key circle-ci \
72
- --keyring build-tools \
73
- --location $GCLOUD_COMPUTE_ZONE \
74
- --plaintext-file .env \
75
- --ciphertext-file .env.enc
76
-
77
- exit $?
78
- }
79
-
80
59
  if [ "$1" == "-h" ]; then
81
60
  display_usage
82
61
  exit 1
83
62
  fi
84
63
 
85
- printf "\nBITBUCKETCI=[$BITBUCKETCI] CIRCLECI=[$CIRCLECI]\n"
86
-
87
- if [ "$BITBUCKETCI" == "true" ];
88
- then
89
- decryptEnvToPipeline
90
- fi
91
-
92
64
  if [ "$CIRCLECI" == "true" ]; then
93
65
  install_gcloud
94
66
  initialize_gcloud
95
67
  fi
96
68
 
97
- printf "\nXXXXXXXXXX SHOULD NOT BE HERE XXXXXXXXXX\n" && exit 0 # XXX
98
-
99
69
  git_origin=`git config --get remote.origin.url`
100
70
 
101
71
  if [[ $git_origin = https* ]]; then
@@ -105,7 +75,7 @@ else
105
75
  fi
106
76
 
107
77
  # Set project based on org name
108
- printf "\nSON OF A BITCH XXX - Detecting organization name...\n"
78
+ printf "\nDetecting organization name...\n"
109
79
 
110
80
  if [ "$git_orgname" = "leverege" ]; then
111
81
  printf "\nUsing leverege\n\n"
@@ -140,4 +110,4 @@ if [ -f "secrets.tar.gz.enc" ]; then
140
110
 
141
111
  # untar secrets.tar.gz
142
112
  tar xvzf secrets.tar.gz
143
- fi
113
+ fi