-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (56 loc) · 2.16 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copyright 2022 Nexient LLC
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
REPO_MANIFESTS_URL ?= https://github.com/nexient-llc/module-manifests.git
REPO_BRANCH ?= main
REPO_MANIFEST ?= tf_modules.xml
# Set to true in a pipeline context
IS_PIPELINE ?= false
JOB_NAME ?= job
JOB_EMAIL ?= job@job.job
COMPONENTS_DIR = components
-include $(COMPONENTS_DIR)/Makefile
.PHONY: configure-git-hooks
configure-git-hooks:
pre-commit install
ifeq ($(IS_PIPELINE),true)
.PHONY: git-config
git-config:
$(call config,Bearer $(GIT_TOKEN))
define config
@set -ex; \
git config --global http.extraheader "AUTHORIZATION: $(1)"; \
git config --global http.https://gerrit.googlesource.com/git-repo/.extraheader ''; \
git config --global http.version HTTP/1.1; \
git config --global user.name "$(JOB_NAME)"; \
git config --global user.email "$(JOB_EMAIL)"; \
git config --global color.ui false
endef
configure: git-config
endif
.PHONY: configure
configure: configure-git-hooks
repo init \
-u "$(REPO_MANIFESTS_URL)" \
-b "$(REPO_BRANCH)" \
-m "$(REPO_MANIFEST)"
repo sync
# The first line finds and removes all the directories pulled in by repo
# The second line finds and removes all the broken symlinks from removing things
# https://stackoverflow.com/questions/42828021/removing-files-with-rm-using-find-and-xargs
.PHONY: clean
clean:
repo list | awk '{ print $1; }' | cut -d '/' -f1 | uniq | xargs rm -rf
find . -type l ! -exec test -e {} \; -print | xargs rm -rf