| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2017 The LUCI Authors. |
| 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at |
| 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 # See the License for the specific language governing permissions and |
| 13 # limitations under the License. |
| 14 |
| 15 # This Makefile (GNU) controls the construction and deployment of the |
| 16 # "luci-logdog" application. This is a common Makefile, and is expected to be |
| 17 # imported by an implementation-specific Makefile. The implementation-specific |
| 18 # Makefile must supply the following variables: |
| 19 # |
| 20 # - CLOUD_PROJECT |
| 21 # |
| 22 # The Makefile may supply the following optional variables: |
| 23 # - TAG: The AppEngine tag. If not specified, let "gae.py" choose a |
| 24 # tag (default, important for production). |
| 25 |
| 26 .PHONY: default |
| 27 default: help |
| 28 |
| 29 # Assert that all required variables are provided. |
| 30 ifndef CLOUD_PROJECT |
| 31 $(error Missing required variable: CLOUD_PROJECT) |
| 32 endif |
| 33 |
| 34 # Determine "luci-go" repository paths. |
| 35 mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) |
| 36 APP_DIR := $(dir $(mkfile_path)) |
| 37 LUCI_GO_DIR := $(abspath $(APP_DIR)/../../../..) |
| 38 |
| 39 # VPATH determines the relative paths of Makefile targets. We need to set it |
| 40 # here, since we're expecting to be invoked from a Makefile in a different |
| 41 # directory. This allows our relative paths to be resolved by `make`. |
| 42 VPATH := $(APP_DIR) |
| 43 |
| 44 # If a tag was provided, add it to the "GAE_PY" args. |
| 45 export LUCI_PY_USE_GCLOUD=1 |
| 46 GAE_PY_EXTRA_ARGS = |
| 47 ifdef TAG |
| 48 GAE_PY_EXTRA_ARGS := $(GAE_PY_EXTRA_ARGS) -t $(TAG) |
| 49 endif |
| 50 |
| 51 ALL_SERVICES = default services backend static |
| 52 |
| 53 define HELP_BODY |
| 54 Manage LogDog distributions. |
| 55 |
| 56 Management targets: |
| 57 web: Builds static web content into the 'static' module. |
| 58 |
| 59 Service Targets for: $(ALL_SERVICES) |
| 60 upload-SERVICE: uploads an instance of the service, but doesn't migrate. |
| 61 switch: Switches all services over to the uploaded version. |
| 62 |
| 63 Special Service Targets: |
| 64 upload-static-dev: special command to upload an instance of the static |
| 65 module named "dev". This can be whitelisted for OAuth for authenticated |
| 66 testing. |
| 67 |
| 68 endef |
| 69 |
| 70 .PHONY: help |
| 71 help: |
| 72 $(info $(HELP_BODY)) |
| 73 |
| 74 .PHONY: yamls |
| 75 yamls: vmuser/app.yaml vmuser/dispatch.yaml vmuser/index.yaml |
| 76 |
| 77 .PHONY: web |
| 78 web: |
| 79 -rm -rf $(APP_DIR)static/dist |
| 80 $(LUCI_GO_DIR)/web/web.py build \ |
| 81 --build-dir $(APP_DIR)static \ |
| 82 logdog-app \ |
| 83 logdog-view \ |
| 84 rpcexplorer |
| 85 |
| 86 # Default resources definition. |
| 87 .PHONY: $(addsuffix -resources,$(ALL_SERVICES)) |
| 88 $(addsuffix -resources,$(ALL_SERVICES)):: |
| 89 |
| 90 # The "static" module requires additional resources. |
| 91 static-resources:: web |
| 92 |
| 93 ## |
| 94 # Per-module Build Rules |
| 95 # |
| 96 # upload-<module>: Uploads the module, but doesn't set it to be default. |
| 97 # deploy-<module>: Uploads the module and sets it to be default. |
| 98 ## |
| 99 |
| 100 .PHONY: $(addprefix upload-,$(ALL_SERVICES)) |
| 101 $(addprefix upload-,$(ALL_SERVICES)): upload-%: %-resources yamls |
| 102 cd $(APP_DIR) && \ |
| 103 gae.py upload \ |
| 104 -A $(CLOUD_PROJECT) \ |
| 105 $(GAE_PY_EXTRA_ARGS) \ |
| 106 --force \ |
| 107 $* |
| 108 |
| 109 .PHONY: upload |
| 110 upload: $(addsuffix -resources,$(ALL_SERVICES)) |
| 111 cd $(APP_DIR) && \ |
| 112 gae.py upload \ |
| 113 -A $(CLOUD_PROJECT) \ |
| 114 $(GAE_PY_EXTRA_ARGS) \ |
| 115 --force \ |
| 116 $(ALL_SERVICES) |
| 117 |
| 118 .PHONY: switch |
| 119 switch: |
| 120 cd $(APP_DIR) && \ |
| 121 gcloud \ |
| 122 --project $(CLOUD_PROJECT) \ |
| 123 app versions migrate \ |
| 124 $$(gae.py version -A $(CLOUD_PROJECT) $(GAE_PY_E
XTRA_ARGS)) \ |
| 125 $(addprefix --service=,$(ALL_SERVICES)) |
| 126 |
| 127 # This is a special make target to upload the static module named "dev". This |
| 128 # version can be specifically whitelisted by the service account to enable |
| 129 # authentication and test a production instance. |
| 130 .PHONY: upload-static-dev |
| 131 upload-static-dev: static-resources yamls |
| 132 cd $(APP_DIR) && \ |
| 133 gcloud app deploy \ |
| 134 --project $(CLOUD_PROJECT) \ |
| 135 --version "dev" \ |
| 136 --quiet \ |
| 137 static/module-static.yaml |
| OLD | NEW |