Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numbsafari/5bfaef9a7de0c03b04b299780654bb82 to your computer and use it in GitHub Desktop.
Save numbsafari/5bfaef9a7de0c03b04b299780654bb82 to your computer and use it in GitHub Desktop.
# Create a GCP debian-9 (stretch) instance and then SSH into it
# gcloud compute instances create test-please --zone=us-east4-c --machine-type=n1-standard-2 --subnet=default --network-tier=PREMIUM --maintenance-policy=MIGRATE --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --image=debian-9-stretch-v20190423 --image-project=debian-cloud --boot-disk-size=10GB --boot-disk-type=pd-standard --boot-disk-device-name=test-please
# gcloud compute ssh test-please
# From there, run the following two blocks of code to initialize the environment and run the go tests
# setup please pre-reqs
sudo apt-get update -y
sudo apt-get install -y --fix-missing golang-1.11 python3-pip git default-jre default-jdk
mkdir -p ~/.config/please
cat <<EOF > ~/.config/please/plzconfig
[Build]
path = /usr/lib/go-1.11/bin:/usr/local/bin:/usr/bin:/bin
[Go]
goroot = /usr/lib/go-1.11/
EOF
# setup please-examples and run go tests
mkdir ~/src
git clone https://github.com/thought-machine/please-examples.git
cd please-examples
./pleasew test -i go -o proto.language:go
@numbsafari
Copy link
Author

The output of the final command is current:

Can't determine version, will use latest.
Downloading Please 13.6.1 to /home/swilson/.please/13.6.1...
Should be good to go now, running plz...
Build stopped after 45.59s. 1 target failed:
    //cc:_kitten_lib#kitten_cc
Error building target //cc:_kitten_lib#kitten_cc: exit status 1
In file included from cc/kitten.cc:1:0:
./cc/kitten.h, line 5, column 29: fatal error: proto/kitten.pb.h: No such file or directory
 #include "proto/kitten.pb.h"
                             ^
compilation terminated.

@numbsafari
Copy link
Author

To accomplish the same thing locally using goenv and pyenv to manage my local installs of each, I did the following:

cd ~/src/please-examples
pyenv local 3.7.3   # create .python-version
goenv local 1.12.4  # create .go-version
cat <<EOF > localize
#!/bin/bash
cat <<EOF > .plzconfig.local
[Build]
path = $(dirname $(goenv which go)):$(dirname $(pyenv which python)):/usr/local/bin:/usr/bin:/bin

[Go]
goroot = $(dirname $(dirname $(goenv which go)))
EOF
chmod u+x localize
./localize  # create a .plzconfig.local file based on my active python and go versions
sudo apt-get update && sudo apt-get install -y default-jdk default-jre # I don't care about java, but I need it to keep plz happy here

Now, when I run the pleasew command to run the tests, I get the same error as I do on the VM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment