Skip to content

Commit

Permalink
Use go modules for a website and update go version (#1457)
Browse files Browse the repository at this point in the history
* Use go modules for a website and update go version

`make site-deploy` target is working properly.

* Remove faking the GOPATH step in cloudbuild yaml
  • Loading branch information
aLekSer authored Apr 8, 2020
1 parent d9d7b16 commit 2215f8d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
6 changes: 3 additions & 3 deletions build/includes/website.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ site-gen-app-yaml:

site-deploy: site-gen-app-yaml site-static
docker run -t --rm $(common_mounts) --workdir=$(mount_path) $(DOCKER_RUN_ARGS) \
-e GOPATH=/tmp/go -e GO111MODULE=off -e SHORT_SHA=$(shell git rev-parse --short=7 HEAD) $(build_tag) bash -c \
'printenv && mkdir -p $$GOPATH/src && cp -r ./site $$GOPATH/src && cp -r ./vendor/gopkg.in $$GOPATH/src && \
cd $$GOPATH/src/site && gcloud app deploy .app.yaml --no-promote --quiet --version=$$SHORT_SHA'
-e GO111MODULE=on -e SHORT_SHA=$(shell git rev-parse --short=7 HEAD) $(build_tag) bash -c \
'printenv && cd ./site && \
gcloud app deploy .app.yaml --no-promote --quiet --version=$$SHORT_SHA'

site-static-preview:
$(MAKE) site-static ARGS="-F" ENV="RELEASE_VERSION=$(base_version) RELEASE_BRANCH=master"
Expand Down
10 changes: 3 additions & 7 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,15 @@ steps:
- tests
dir: "build"
args: ["site-static-preview", "site-gen-app-yaml", "SERVICE=preview"]
- name: "ubuntu" # fake a new gopath
id: site-gopath
waitFor:
- site-static
args: ["bash", "-c", "mkdir -p ./go/src && mv ./site ./go/src && cp -r ./vendor/gopkg.in ./go/src && ls -a ./go/src/site"]
- name: "gcr.io/cloud-builders/gcloud" # deploy the preview of the website
id: "deploy-site-static"
waitFor:
- site-gopath
dir: "go/src/site"
- site-static
dir: "site"
args: ["app", "deploy", ".app.yaml", "--no-promote", "--version=$SHORT_SHA"]
env:
- GOPATH=/workspace/go
- GO111MODULE=on

#
# Run the e2e tests
Expand Down
2 changes: 1 addition & 1 deletion site/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

runtime: go111
runtime: go113
service: ${SERVICE}

handlers:
Expand Down
11 changes: 5 additions & 6 deletions site/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,26 @@ steps:
- name: "make-docker" # build production version of the site
dir: "build"
args: ["site-static", "site-gen-app-yaml", "ENV=HUGO_ENV=production"]
- name: "ubuntu" # fake a new gopath
args: ["bash", "-c", "mkdir -p ./go/src && cp -r ./site ./go/src && cp -r ./vendor/gopkg.in ./go/src && ls -a ./go/src/site"]
- name: "gcr.io/cloud-builders/gcloud" # deploy the website
dir: "go/src/site"
dir: "site"
args: ["app", "deploy", ".app.yaml", "--promote", "--version=$SHORT_SHA"]
env:
- GOPATH=/workspace/go
- GO111MODULE=on

#
# Build development site and deploy
#


- name: "make-docker" # build a preview of the website
dir: "build"
args: ["site-static-preview", "site-gen-app-yaml", "SERVICE=development"]
- name: "ubuntu" # fake a new gopath
args: ["bash", "-c", "rm -r ./go/src && mkdir -p ./go/src && cp -r ./site ./go/src && cp -r ./vendor/gopkg.in ./go/src && ls -a ./go/src/site"]
- name: "gcr.io/cloud-builders/gcloud" # deploy the preview of the website
dir: "go/src/site"
dir: "site"
args: ["app", "deploy", ".app.yaml", "--promote", "--version=$SHORT_SHA"]
env:
- GOPATH=/workspace/go
- GO111MODULE=on

tags: ["site"]
5 changes: 5 additions & 0 deletions site/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/agones/agones/site

go 1.13

require gopkg.in/yaml.v2 v2.2.8
4 changes: 4 additions & 0 deletions site/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

0 comments on commit 2215f8d

Please sign in to comment.