Skip to content

Commit 9ef96e4

Browse files
authored
Packagespec v0.1.2/master (#9995)
* packagespec v0.1.2 - prep: remove unneeded code * packagespec v0.1.2 - packagespec init * packagespec v0.1.2 - make packages * packagespec v0.1.3 - make packages
1 parent d626f58 commit 9ef96e4

File tree

54 files changed

+5108
-4100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+5108
-4100
lines changed

.circleci/config.yml

+1,067-507
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.circleci/config/@build-release.yml

+1,217-489
Large diffs are not rendered by default.

.circleci/config/@build-release.yml.tpl

-229
This file was deleted.

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
vendor/* linguist-vendored
22
website/* linguist-documentation
3+
4+
/packagespec.mk linguist-generated

Makefile

+7-72
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,8 @@ ci-lint:
120120
prep: fmtcheck
121121
@sh -c "'$(CURDIR)/scripts/goversioncheck.sh' '$(GO_VERSION_MIN)'"
122122
@$(GO_CMD) generate $($(GO_CMD) list ./... | grep -v /vendor/)
123-
@# Remove old (now broken) husky git hooks.
124-
@[ ! -d .git/hooks ] || grep -l '^# husky$$' .git/hooks/* | xargs rm -f
125123
@if [ -d .git/hooks ]; then cp .hooks/* .git/hooks/; fi
126124

127-
PACKAGES_LOCK_DIR := $(shell find . -mindepth 1 -maxdepth 1 \
128-
-type d -name 'packages*.lock')
129-
130125
# bootstrap the build by downloading additional tools needed to build
131126
ci-bootstrap:
132127
@for tool in $(EXTERNAL_TOOLS_CI) ; do \
@@ -249,76 +244,14 @@ hana-database-plugin:
249244
mongodb-database-plugin:
250245
@CGO_ENABLED=0 $(GO_CMD) build -o bin/mongodb-database-plugin ./plugins/database/mongodb/mongodb-database-plugin
251246

252-
# WRITE_GENERATED_FILE_HEADER overwrites the file specified, replacing its contents with
253-
# the header warning people not to attempt to edit or merge the file. You should call this
254-
# before writing the generated contents to the file.
255-
# Args: 1: File to write; 2: Command to generate it; 3: Source files to edit/merge instead.
256-
define WRITE_GENERATED_FILE_HEADER
257-
echo "### ***" > $(1); \
258-
echo "### WARNING: DO NOT manually EDIT or MERGE this file, it is generated by '$(2)'." >> $(1); \
259-
echo "### INSTEAD: Edit or merge the source in $(3) then run '$(2)'." >> $(1); \
260-
echo "### ***" >> $(1)
261-
endef
262-
263-
## begin packagespec integration ##
264-
265-
# The plan is to generate this packagespec integration section automatically.
266-
# By keeping it in a contiguous block for now, it will be easier to
267-
# auto-generate when we get to it.
268-
269-
SPEC_FILE_PATTERN := packages*.yml
270-
# SPEC is the human-managed description of which packages we are able to build.
271-
SPEC := $(shell find . -mindepth 1 -maxdepth 1 -name '$(SPEC_FILE_PATTERN)')
272-
ifneq ($(words $(SPEC)),1)
273-
$(error Found $(words $(SPEC)) $(SPEC_FILE_PATTERN) files, need exactly 1: $(SPEC))
274-
endif
275-
SPEC_FILENAME := $(notdir $(SPEC))
276-
SPEC_MODIFIER := $(SPEC_FILENAME:packages%.yml=%)
277-
# LOCKDIR contains the lockfile and layer files.
278-
LOCKDIR := packages$(SPEC_MODIFIER).lock
279-
LOCKFILE := $(LOCKDIR)/pkgs.yml
280-
281-
export PACKAGE_SPEC_ID LAYER_SPEC_ID PRODUCT_REVISION PRODUCT_VERSION
282-
283-
# PACKAGESPEC_TARGETS are convenience aliases for targets defined in $(LOCKDIR)/Makefile
284-
PACKAGESPEC_TARGETS := \
285-
build build-all build-ci \
286-
aliases meta package \
287-
package-meta stage-config stage \
288-
watch-ci publish-config publish list-staged-builds
289-
290-
$(PACKAGESPEC_TARGETS):
291-
@PRODUCT_REPO_ROOT="$(shell git rev-parse --show-toplevel)" $(MAKE) -C $(LOCKDIR) $@
292-
293-
# packages regenerates $(LOCKDIR) from $(SPEC) using packagespec. This is only for
294-
# internal HashiCorp use, as it has dependencies not available to OSS contributors.
295-
packages:
296-
@command -v packagespec > /dev/null 2>&1 || { \
297-
echo "Please install packagespec."; \
298-
echo "Note: packagespec is only available to HashiCorp employees at present."; \
299-
exit 1; \
300-
}
301-
@packagespec lock -specfile $(SPEC) -lockdir $(LOCKDIR)
302-
@$(MAKE) ci-config
303-
304-
.PHONY: $(PACKAGESPEC_TARGETS) packages
305-
## end packagespec integration ##
247+
# Tell packagespec where to write its CircleCI config.
248+
PACKAGESPEC_CIRCLECI_CONFIG := .circleci/config/@build-release.yml
306249

307-
CI_WORKFLOW_TPL := .circleci/config/@build-release.yml.tpl
308-
CI_WORKFLOW := .circleci/config/@build-release.yml
309-
310-
.PHONY: ci-update-release-packages $(CI_WORKFLOW)
311-
ci-update-release-packages: $(CI_WORKFLOW)
312-
@echo $^
313-
314-
$(CI_WORKFLOW): $(LOCKFILE) $(CI_WORKFLOW_TPL)
315-
@\
316-
echo "==> Updating $@ to match $<"; \
317-
$(call WRITE_GENERATED_FILE_HEADER,$@,make $@,$^); \
318-
cat $< | gomplate -f $(CI_WORKFLOW_TPL) -d 'package-list=stdin://?type=application/yaml' >> $@
250+
# Tell packagespec to re-run 'make ci-config' whenever updating its own CI config.
251+
PACKAGESPEC_HOOK_POST_CI_CONFIG := $(MAKE) ci-config
319252

320253
.PHONY: ci-config
321-
ci-config: ci-update-release-packages
254+
ci-config: $(PACKAGESPEC_CIRCLECI_CONFIG)
322255
@$(MAKE) -C .circleci ci-config
323256
.PHONY: ci-verify
324257
ci-verify:
@@ -327,3 +260,5 @@ ci-verify:
327260
.PHONY: bin default prep test vet bootstrap ci-bootstrap fmt fmtcheck mysql-database-plugin mysql-legacy-database-plugin cassandra-database-plugin influxdb-database-plugin postgresql-database-plugin mssql-database-plugin hana-database-plugin mongodb-database-plugin static-assets ember-dist ember-dist-dev static-dist static-dist-dev assetcheck check-vault-in-path check-browserstack-creds test-ui-browserstack packages build build-ci
328261

329262
.NOTPARALLEL: ember-dist ember-dist-dev static-assets
263+
264+
-include packagespec.mk

packages-oss.lock/.gitattributes

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)