A configuration management service with support for secrets.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

121 lignes
3.5KB

  1. # Copyright 2018 AT&T Intellectual Property. All other rights reserved.
  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. BUILD_DIR := $(shell mkdir -p build && mktemp -d -p build)
  15. DOCKER_REGISTRY ?= quay.io
  16. IMAGE_NAME ?= deckhand
  17. IMAGE_PREFIX ?= airshipit
  18. IMAGE_TAG ?= latest
  19. DISTRO_BASE_IMAGE ?=
  20. HELM := $(shell realpath $(BUILD_DIR))/helm
  21. PROXY ?= http://proxy.foo.com:8000
  22. NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
  23. USE_PROXY ?= false
  24. PUSH_IMAGE ?= false
  25. # use this variable for image labels added in internal build process
  26. LABEL ?= org.airshipit.build=community
  27. DISTRO ?= ubuntu_bionic
  28. COMMIT ?= $(shell git rev-parse HEAD)
  29. IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO}
  30. export
  31. # Build Deckhand Docker image for this project
  32. .PHONY: images
  33. images: build_deckhand
  34. # Create tgz of the chart
  35. .PHONY: charts
  36. charts: helm-init
  37. $(HELM) dep up charts/deckhand
  38. $(HELM) package charts/deckhand
  39. # Initialize local helm config
  40. .PHONY: helm-init
  41. helm-init: helm-install
  42. tools/helm_tk.sh $(HELM)
  43. # Install helm binary
  44. .PHONY: helm-install
  45. helm-install:
  46. tools/helm_install.sh $(HELM)
  47. # Perform linting
  48. .PHONY: lint
  49. lint: pep8 helm_lint
  50. # Dry run templating of chart
  51. .PHONY: dry-run
  52. dry-run: clean
  53. tools/helm_tk.sh $(HELM)
  54. $(HELM) template charts/deckhand
  55. .PHONY: tests
  56. tests:
  57. tox
  58. _BASE_IMAGE_ARG := $(if $(DISTRO_BASE_IMAGE),--build-arg FROM="${DISTRO_BASE_IMAGE}" ,)
  59. # Make targets intended for use by the primary targets above.
  60. .PHONY: build_deckhand
  61. build_deckhand:
  62. ifeq ($(USE_PROXY), true)
  63. docker build --network host -t $(IMAGE) --label $(LABEL) \
  64. --label "org.opencontainers.image.revision=$(COMMIT)" \
  65. --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
  66. --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
  67. $(_BASE_IMAGE_ARG) \
  68. -f images/deckhand/Dockerfile.$(DISTRO) \
  69. --build-arg http_proxy=$(PROXY) \
  70. --build-arg https_proxy=$(PROXY) \
  71. --build-arg HTTP_PROXY=$(PROXY) \
  72. --build-arg HTTPS_PROXY=$(PROXY) \
  73. --build-arg no_proxy=$(NO_PROXY) \
  74. --build-arg NO_PROXY=$(NO_PROXY) .
  75. else
  76. docker build --network host -t $(IMAGE) --label $(LABEL) \
  77. --label "org.opencontainers.image.revision=$(COMMIT)" \
  78. --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
  79. --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
  80. $(_BASE_IMAGE_ARG) \
  81. -f images/deckhand/Dockerfile.$(DISTRO) .
  82. endif
  83. ifeq ($(PUSH_IMAGE), true)
  84. docker push $(IMAGE)
  85. endif
  86. .PHONY: clean
  87. clean:
  88. rm -rf build
  89. helm delete helm-template ||:
  90. rm -rf doc/build
  91. # Don't remove .placeholder from doc/source/_static/
  92. rm -rf doc/api doc/source/_static/* doc/source/contributor/api
  93. .PHONY: docs
  94. docs: clean build_docs
  95. .PHONY: build_docs
  96. build_docs:
  97. tox -e docs
  98. .PHONY: pep8
  99. pep8:
  100. tox -e pep8
  101. .PHONY: helm_lint
  102. helm_lint: clean
  103. tools/helm_tk.sh $(HELM)
  104. $(HELM) lint charts/deckhand