1
+ # ## BEGIN HEADERS ###
2
+ # This block is managed by ServiceBot plugin - Make. The content in this block is created using a common
3
+ # template and configurations in service.yml.
4
+ # Modifications in this block will be overwritten by generated content in the nightly run.
5
+ # For more information, please refer to the page:
6
+ # https://confluentinc.atlassian.net/wiki/spaces/Foundations/pages/2871328913/Add+Make
7
+ SERVICE_NAME := cli
8
+ SERVICE_DEPLOY_NAME := cli
9
+
10
+ # ## END HEADERS ###
11
+ # ## BEGIN MK-INCLUDE UPDATE ###
12
+ # ## This section is managed by service-bot and should not be edited here.
13
+ # ## You can make changes upstream in https://github.com/confluentinc/cc-service-bot
14
+
15
+ CURL ?= curl
16
+ FIND ?= find
17
+ TAR ?= tar
18
+
19
+ # Mount netrc so curl can work from inside a container
20
+ DOCKER_NETRC_MOUNT ?= 1
21
+
22
+ GITHUB_API = api.github.com
23
+ GITHUB_MK_INCLUDE_OWNER := confluentinc
24
+ GITHUB_MK_INCLUDE_REPO := cc-mk-include
25
+ GITHUB_API_CC_MK_INCLUDE := https://$(GITHUB_API ) /repos/$(GITHUB_MK_INCLUDE_OWNER ) /$(GITHUB_MK_INCLUDE_REPO )
26
+ GITHUB_API_CC_MK_INCLUDE_TARBALL := $(GITHUB_API_CC_MK_INCLUDE ) /tarball
27
+ GITHUB_API_CC_MK_INCLUDE_VERSION ?= $(GITHUB_API_CC_MK_INCLUDE_TARBALL ) /$(MK_INCLUDE_VERSION )
28
+
29
+ MK_INCLUDE_DIR := mk-include
30
+ MK_INCLUDE_LOCKFILE := .mk-include-lockfile
31
+ MK_INCLUDE_TIMESTAMP_FILE := .mk-include-timestamp
32
+ # For optimum performance, you should override MK_INCLUDE_TIMEOUT_MINS above the managed section headers to be
33
+ # a little longer than the worst case cold build time for this repo.
34
+ MK_INCLUDE_TIMEOUT_MINS ?= 240
35
+ # If this latest validated release is breaking you, please file a ticket with DevProd describing the issue, and
36
+ # if necessary you can temporarily override MK_INCLUDE_VERSION above the managed section headers until the bad
37
+ # release is yanked.
38
+ MK_INCLUDE_VERSION ?= v0.1360.0
39
+
40
+ # Make sure we always have a copy of the latest cc-mk-include release less than $(MK_INCLUDE_TIMEOUT_MINS) old:
41
+ # Note: The simply-expanded make variable makes sure this is run once per make invocation.
42
+ UPDATE_MK_INCLUDE := $(shell \
43
+ func_fatal() { echo "$$* " >&2; echo output here triggers error below; exit 1; } ; \
44
+ test -z "` git ls-files $( MK_INCLUDE_DIR) ` " || { \
45
+ func_fatal 'fatal: checked in $(MK_INCLUDE_DIR ) / directory is preventing make from fetching recent cc-mk-include releases for CI'; \
46
+ } ; \
47
+ trap "rm -f $(MK_INCLUDE_LOCKFILE ) ; exit" 0 2 3 15; \
48
+ waitlock=0; while ! ( set -o noclobber; echo > $(MK_INCLUDE_LOCKFILE ) ); do \
49
+ sleep $$waitlock; waitlock=` expr $$ waitlock + 1 ` ; \
50
+ test 14 -lt $$waitlock && { \
51
+ echo 'stealing stale lock after 105s' >&2; \
52
+ break; \
53
+ } \
54
+ done; \
55
+ test -s $(MK_INCLUDE_TIMESTAMP_FILE ) || rm -f $(MK_INCLUDE_TIMESTAMP_FILE ) ; \
56
+ { test -d $(MK_INCLUDE_DIR ) && test -d /proc && test -z "$(cat /proc/1/sched 2>&1 |head -n 1 |grep init ) "; } || \
57
+ test -z "` $( FIND) $( MK_INCLUDE_TIMESTAMP_FILE) -mmin +$( MK_INCLUDE_TIMEOUT_MINS) 2>&1 ` " || { \
58
+ GHAUTH=$$(grep -sq 'machine $(GITHUB_API ) ' ~/.netrc && echo netrc || \
59
+ ( command -v gh > /dev/null && gh auth status -h github.com > /dev/null && echo gh ) ); \
60
+ test -n "$$GHAUTH" || \
61
+ func_fatal 'error: no GitHub token available via "~/.netrc" or "gh auth status".\nFollow https://confluentinc.atlassian.net/l/cp/0WXXRLDh to setup GitHub authentication.\n'; \
62
+ echo "downloading $(GITHUB_MK_INCLUDE_OWNER ) /$(GITHUB_MK_INCLUDE_REPO ) $(MK_INCLUDE_VERSION ) using $$GHAUTH" >&2; \
63
+ if [ "netrc" = "$$GHAUTH" ]; then \
64
+ $(CURL ) --fail --silent --netrc --location "$(GITHUB_API_CC_MK_INCLUDE_VERSION ) " --output $(MK_INCLUDE_TIMESTAMP_FILE ) T --write-out '$(GITHUB_API_CC_MK_INCLUDE_VERSION ) : %{errormsg}\n' >&2; \
65
+ else \
66
+ gh release download --clobber --repo=$(GITHUB_MK_INCLUDE_OWNER ) /$(GITHUB_MK_INCLUDE_REPO ) \
67
+ --archive=tar.gz --output $(MK_INCLUDE_TIMESTAMP_FILE ) T $(MK_INCLUDE_VERSION ) >&2; \
68
+ fi \
69
+ && TMP_MK_INCLUDE_DIR=$$(mktemp -d -t cc-mk-include.XXXXXXXXXX ) \
70
+ && $(TAR ) -C $$TMP_MK_INCLUDE_DIR --strip-components=1 -zxf $(MK_INCLUDE_TIMESTAMP_FILE ) T \
71
+ && rm -rf $$TMP_MK_INCLUDE_DIR/tests \
72
+ && rm -rf $(MK_INCLUDE_DIR ) \
73
+ && mv $$TMP_MK_INCLUDE_DIR $(MK_INCLUDE_DIR ) \
74
+ && mv -f $(MK_INCLUDE_TIMESTAMP_FILE ) T $(MK_INCLUDE_TIMESTAMP_FILE ) \
75
+ && echo 'installed cc-mk-include $(MK_INCLUDE_VERSION ) from $(GITHUB_MK_INCLUDE_OWNER ) /$(GITHUB_MK_INCLUDE_REPO ) ' >&2 \
76
+ || func_fatal unable to install cc-mk-include $(MK_INCLUDE_VERSION ) from $(GITHUB_MK_INCLUDE_OWNER ) /$(GITHUB_MK_INCLUDE_REPO ) \
77
+ ; \
78
+ } || { \
79
+ rm -f $(MK_INCLUDE_TIMESTAMP_FILE ) T; \
80
+ if test -f $(MK_INCLUDE_TIMESTAMP_FILE ) ; then \
81
+ touch $(MK_INCLUDE_TIMESTAMP_FILE ) ; \
82
+ func_fatal 'unable to access $(GITHUB_MK_INCLUDE_REPO ) fetch API to check for latest release; next try in $(MK_INCLUDE_TIMEOUT_MINS ) minutes'; \
83
+ else \
84
+ func_fatal 'unable to access $(GITHUB_MK_INCLUDE_REPO ) fetch API to bootstrap mk-include subdirectory'; \
85
+ fi; \
86
+ } \
87
+ )
88
+ ifneq ($(UPDATE_MK_INCLUDE ) ,)
89
+ $(error mk-include update failed)
90
+ endif
91
+
92
+ # Export the (empty) .mk-include-check-FORCE target to allow users to trigger the mk-include
93
+ # download code above via make but without having to run any of the other targets, e.g. build.
94
+ .PHONY : .mk-include-check-FORCE
95
+ .mk-include-check-FORCE :
96
+ @echo -n " "
97
+ # ## END MK-INCLUDE UPDATE ###
98
+ # ## BEGIN INCLUDES ###
99
+ # This block is managed by ServiceBot plugin - Make. The content in this block is created using a common
100
+ # template and configurations in service.yml.
101
+ # Modifications in this block will be overwritten by generated content in the nightly run. To include
102
+ # additional mk files, please add them before or after this generated block.
103
+ # For more information, please refer to the page:
104
+ # https://confluentinc.atlassian.net/wiki/spaces/Foundations/pages/2871328913/Add+Make
105
+ include ./mk-include/cc-begin.mk
106
+ include ./mk-include/cc-semver.mk
107
+ include ./mk-include/cc-semaphore.mk
108
+ include ./mk-include/cc-go.mk
109
+ include ./mk-include/cc-testbreak.mk
110
+ include ./mk-include/cc-vault.mk
111
+ include ./mk-include/cc-sonarqube.mk
112
+ include ./mk-include/cc-end.mk
113
+ # ## END INCLUDES ###
1
114
SHELL := /bin/bash
2
115
GORELEASER_VERSION := v1.21.2
3
116
@@ -148,4 +261,4 @@ coverage: ## Merge coverage data from unit and integration tests into coverage.t
148
261
@tail -n +2 coverage.unit.out >> coverage.txt
149
262
@tail -n +2 coverage.integration.out >> coverage.txt
150
263
@echo " Coverage data saved to: coverage.txt"
151
- @artifact push workflow coverage.txt
264
+ @artifact push workflow coverage.txt
0 commit comments