@leverege/build-tools 2.17.4 → 2.18.0-beta.10

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.17.4",
3
+ "version": "2.18.0-beta.10",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -5,6 +5,7 @@ display_usage() {
5
5
  }
6
6
 
7
7
  install_gcloud() {
8
+ uname -a
8
9
  install () {
9
10
  # Set sudo to work whether logged in as root user or non-root user
10
11
  if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi
@@ -56,16 +57,48 @@ initialize_gcloud() {
56
57
  gcloud --quiet config set compute/zone ${GOOGLE_COMPUTE_ZONE}
57
58
  }
58
59
 
60
+ function decryptEnvToPipeline() {
61
+ printf "______________BitBucket Pipeline Detected______________\n"
62
+ printf " GCLOUD_PROJECT [$GCLOUD_PROJECT]\n"
63
+ printf " GCLOUD_COMPUTE_ZONE [$GCLOUD_COMPUTE_ZONE]\n"
64
+
65
+ install_gcloud
66
+
67
+ gcloud --quiet config set project ${GCLOUD_PROJECT}
68
+ gcloud --quiet config set compute/zone ${GCLOUD_COMPUTE_ZONE}
69
+ echo ${GCLOUD_SERVICE_KEY} | gcloud auth activate-service-account --key-file=-
70
+
71
+ # decrypt .env.enc file
72
+ gcloud kms decrypt \
73
+ --project $GCLOUD_PROJECT \
74
+ --key circle-ci \
75
+ --keyring build-tools \
76
+ --location $GCLOUD_COMPUTE_ZONE \
77
+ --plaintext-file .env \
78
+ --ciphertext-file .env.enc
79
+
80
+ exit $?
81
+ }
82
+
59
83
  if [ "$1" == "-h" ]; then
60
84
  display_usage
61
85
  exit 1
62
86
  fi
63
87
 
88
+ printf "\nBITBUCKETCI=[$BITBUCKETCI] CIRCLECI=[$CIRCLECI]\n"
89
+
90
+ if [ "$BITBUCKETCI" == "true" ];
91
+ then
92
+ decryptEnvToPipeline
93
+ fi
94
+
64
95
  if [ "$CIRCLECI" == "true" ]; then
65
96
  install_gcloud
66
97
  initialize_gcloud
67
98
  fi
68
99
 
100
+ printf "\nXXXXXXXXXX SHOULD NOT BE HERE XXXXXXXXXX\n" && exit 0 # XXX
101
+
69
102
  git_origin=`git config --get remote.origin.url`
70
103
 
71
104
  if [[ $git_origin = https* ]]; then
@@ -75,7 +108,7 @@ else
75
108
  fi
76
109
 
77
110
  # Set project based on org name
78
- printf "\nDetecting organization name...\n"
111
+ printf "\nSON OF A BITCH XXX - Detecting organization name...\n"
79
112
 
80
113
  if [ "$git_orgname" = "leverege" ]; then
81
114
  printf "\nUsing leverege\n\n"
@@ -110,4 +143,4 @@ if [ -f "secrets.tar.gz.enc" ]; then
110
143
 
111
144
  # untar secrets.tar.gz
112
145
  tar xvzf secrets.tar.gz
113
- fi
146
+ fi