@leverege/build-tools 2.18.0-beta.1 → 2.18.0-beta.11

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.1",
3
+ "version": "2.18.0-beta.11",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -22,7 +22,6 @@
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",
26
25
  "decrypt-secrets": "src/decrypt-secrets",
27
26
  "dirty-git": "src/dirty-git",
28
27
  "dockreate": "src/dockreate",
@@ -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,11 +57,41 @@ 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
@@ -75,7 +106,7 @@ else
75
106
  fi
76
107
 
77
108
  # Set project based on org name
78
- printf "\nDetecting organization name...\n"
109
+ printf "\nSON OF A BITCH XXX - Detecting organization name...\n"
79
110
 
80
111
  if [ "$git_orgname" = "leverege" ]; then
81
112
  printf "\nUsing leverege\n\n"
@@ -110,4 +141,4 @@ if [ -f "secrets.tar.gz.enc" ]; then
110
141
 
111
142
  # untar secrets.tar.gz
112
143
  tar xvzf secrets.tar.gz
113
- fi
144
+ fi
@@ -1,14 +0,0 @@
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