Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [DC-761] Update nomad v0.10.4 #11

Merged
merged 1,130 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1130 commits
Select commit Hold shift + click to select a range
4813863
actually always canonicalize alloc.Job
Jan 15, 2020
6c3a29a
e2e: improve reusability of provisioning scripts (#6942)
tgross Jan 16, 2020
9aa4cfe
Avoid unnecessary golang version reference
Jan 16, 2020
8dbb16c
add a script to update golang version
Jan 16, 2020
ee244e9
Update golang to 1.12.15
Jan 16, 2020
ae3030e
Update ecs.html.md
TimHiggison Jan 16, 2020
302e27e
Update configuring-tasks.html.md
TimHiggison Jan 17, 2020
3adb3cd
ui: Change Run Job availability based on ACLs (#5944)
backspace Jan 20, 2020
1e62825
Update changelog
backspace Jan 21, 2020
0aa58b9
e2e: use valid jobspec for group check test (#6967)
tgross Jan 21, 2020
9f86f5a
UI: Migrate to Storybook (#6507)
backspace Jan 21, 2020
0b6b475
e2e: update framework to allow deploying Nomad (#6969)
tgross Jan 22, 2020
2a89e47
e2e: ensure group script check tests interpolation (#6972)
tgross Jan 22, 2020
264932d
Return FailedTGAlloc metric instead of no node err
drewbailey Jan 21, 2020
abde9f9
update changelog
drewbailey Jan 22, 2020
ccd9c14
extract leader step function
Jan 22, 2020
15b782c
Merge pull request #6968 from hashicorp/b-system-sched-plan-ineligible
drewbailey Jan 22, 2020
2810bf3
Handle Nomad leadership flapping
Jan 22, 2020
074f17a
e2e: document e2e provisioning process (#6976)
tgross Jan 22, 2020
bb5f15f
Merge pull request #6780 from hashicorp/km.intro-video
angrycub Jan 23, 2020
2b3db3c
Merge pull request #6952 from TimHiggison/patch-1
schmichael Jan 23, 2020
3ed31eb
Merge pull request #6953 from TimHiggison/patch-2
schmichael Jan 23, 2020
004810d
Add the digital marketing team as the code owners for the website dir
DingoEatingFuzz Jan 23, 2020
a43d108
Mock the eligibility endpoint in mirage
DingoEatingFuzz Oct 25, 2019
649be7f
Implement eligibility toggling in the data layer
DingoEatingFuzz Oct 25, 2019
b22047e
Add isMigrating property to the allocation model
DingoEatingFuzz Oct 25, 2019
1cbbba0
Mock the drain endpoint
DingoEatingFuzz Oct 25, 2019
4ddcd60
drain and forceDrain adapter methods
DingoEatingFuzz Oct 25, 2019
0b031f0
Update drain methods to properly wrap DrainSpec params
DingoEatingFuzz Oct 30, 2019
4d05f53
cancelDrain adapter method
DingoEatingFuzz Nov 2, 2019
3ad8987
Reformat the client detail page to use the two-row header design
DingoEatingFuzz Nov 2, 2019
09b62eb
Add tooltip to the eligibility control
DingoEatingFuzz Nov 2, 2019
44904ba
Update the underlying node model when toggling eligibility in mirage
DingoEatingFuzz Nov 2, 2019
8788d39
Eligibility toggling behavior
DingoEatingFuzz Nov 2, 2019
de03d82
PopoverMenu component
DingoEatingFuzz Nov 6, 2019
b02f05f
Update the dropdown styles to be more similar to button styles
DingoEatingFuzz Nov 6, 2019
5098b55
Multiline modifier for tooltips
DingoEatingFuzz Nov 6, 2019
030b449
More form styles as needed for the drain form
DingoEatingFuzz Nov 6, 2019
0a8c27d
Initial layout of the drain options popover
DingoEatingFuzz Nov 6, 2019
7eb71ca
Let dropdowns assume their full width
DingoEatingFuzz Nov 12, 2019
d401a11
Add triggerClass support to the popover menu
DingoEatingFuzz Nov 12, 2019
e47d255
Factor out the drain popover and implement its behaviors
DingoEatingFuzz Nov 12, 2019
faffb83
Extract the duration parsing into a util
DingoEatingFuzz Nov 12, 2019
6f6b9c2
Test coverage for the parse duration util
DingoEatingFuzz Nov 12, 2019
da576bc
Refactor parseDuration to support multi-character units
DingoEatingFuzz Nov 12, 2019
2ddc54e
Polish for the drain popover
DingoEatingFuzz Nov 12, 2019
4439853
Stub out all the markup for the new drain strategy view
DingoEatingFuzz Nov 13, 2019
ad8df16
Fill in the drain strategy ribbon values
DingoEatingFuzz Nov 13, 2019
e886361
Fill out the metrics and time since values in the drain summary
DingoEatingFuzz Nov 15, 2019
fabf956
Drain complete notification
DingoEatingFuzz Nov 15, 2019
96522e7
Drain stop and update and notifications
DingoEatingFuzz Nov 19, 2019
504a7af
Modifiers to the two-step-button
DingoEatingFuzz Nov 19, 2019
4bcd47c
Make outline buttons have a solid white background
DingoEatingFuzz Nov 19, 2019
6a0a77c
Force drain button in the drain info box
DingoEatingFuzz Nov 19, 2019
2e39c0a
New toggle component
DingoEatingFuzz Nov 19, 2019
595f3c9
Swap the eligiblity checkbox out for a toggle
DingoEatingFuzz Nov 19, 2019
a36290d
Toggle bugs: focus and multiline alignment
DingoEatingFuzz Nov 19, 2019
3009ad3
Switch drain popover checkboxes for toggles
DingoEatingFuzz Nov 19, 2019
8f67e4b
Clear all notifications when resetting the controller
DingoEatingFuzz Nov 22, 2019
da941d2
Model the notification pattern as a page object component
DingoEatingFuzz Nov 22, 2019
b03e1e6
Update the client detail page object
DingoEatingFuzz Nov 22, 2019
8dadd3d
Integration tests for the toggle component
DingoEatingFuzz Dec 3, 2019
413681e
PopoverMenu integration tests
DingoEatingFuzz Dec 3, 2019
b11c82c
Update existing tests
DingoEatingFuzz Dec 5, 2019
93eaaab
New test coverage for the drain capabilities
DingoEatingFuzz Dec 7, 2019
1d6799e
Stack the popover menu under the subnav
DingoEatingFuzz Dec 13, 2019
4cc6702
Use qunit-dom where applicable
DingoEatingFuzz Dec 13, 2019
66ea7c1
Increase the size and spacing of the toggle component
DingoEatingFuzz Dec 13, 2019
deb2b31
Remove superfluous information from the client details ribbon
DingoEatingFuzz Dec 13, 2019
40d6531
Tweak vertical spacing of headings
DingoEatingFuzz Dec 13, 2019
b9b6cda
Update client detail test given change to the compositeStatus property
DingoEatingFuzz Dec 13, 2019
4793dc9
Replace custom parse-duration implementation with an existing lib
DingoEatingFuzz Dec 13, 2019
fea44b0
Merge pull request #6819 from hashicorp/f-ui-node-drain
DingoEatingFuzz Jan 24, 2020
30af487
fix comment
Jan 27, 2020
9fdc9de
Merge pull request #6950 from hashicorp/c-golang-1.12.15
Jan 27, 2020
64f4e9e
consul: add support for canary meta
nickethier Nov 13, 2019
018f071
website: add canary meta to api docs
nickethier Jan 8, 2020
7892903
Merge pull request #6918 from hashicorp/vendor-godiscover-7698de1
Jan 27, 2020
15ecd0c
docs: add Go versioning policy
schmichael Jan 27, 2020
8be04c0
Merge pull request #6994 from hashicorp/docs-go
schmichael Jan 27, 2020
330d24c
consul: fix var name from rebase
nickethier Jan 27, 2020
b9394da
Merge pull request #6938 from hashicorp/e2e-vault
schmichael Jan 27, 2020
2f88e11
docs: reseting bootstrap doesn't invalidate token
Jan 27, 2020
d6dd9b6
consul: fix var name from rebase
nickethier Jan 27, 2020
27fa0f6
Update website/source/guides/security/acl.html.markdown
Jan 27, 2020
5e789c3
e2e: packer builds should not be public (#6998)
tgross Jan 27, 2020
3aec977
Merge pull request #6690 from hashicorp/f-canary-meta
nickethier Jan 28, 2020
e343315
Merge pull request #6997 from hashicorp/docs-bootstrap-reset
Jan 28, 2020
c68947b
docs: tweaks
Jan 28, 2020
0912400
include test and address review comments
Jan 28, 2020
97f20bd
handle channel close signal
Jan 28, 2020
94a75b4
tweak leadership flapping log messages
Jan 28, 2020
8ae03c3
tests: defer closing shutdownCh
Jan 28, 2020
438f98c
client: canonicalize alloc.Job on restore
Jan 28, 2020
771c8ff
Merge pull request #6977 from hashicorp/b-leadership-flapping-2
Jan 28, 2020
31025d6
Support customizing full scheduler config
Jan 28, 2020
99bc650
tests: run_for is already a string
Jan 28, 2020
eb0acc3
Merge pull request #6935 from hashicorp/b-default-preemption-flag
Jan 28, 2020
b789b50
Merge pull request #6922 from hashicorp/b-alloc-canoncalize
Jan 28, 2020
cdef69a
canary_meta will be part of 0.10.3 (not 0.10.2)
shantanugadgil Jan 29, 2020
8b6a8c0
Merge pull request #7005 from shantanugadgil/patch-2
nickethier Jan 29, 2020
028a470
use golang 1.12.16
Jan 29, 2020
fbd5080
Allow nomad monitor command to lookup server UUID
drewbailey Jan 29, 2020
2dbcad3
fix tests, update changelog
drewbailey Jan 29, 2020
07df966
Merge pull request #7015 from hashicorp/b-allow-monitor-by-server-id
drewbailey Jan 29, 2020
dfc7d97
e2e: add a -suite flag to e2e.Framework
shoenig Jan 29, 2020
a183447
Merge pull request #7009 from hashicorp/golang-1.12.16
Jan 30, 2020
afa26a8
Document default_scheduler_config option
Jan 29, 2020
70b0ec9
document docker's disable_log_collection flag
Jan 29, 2020
fe55b5a
batch mahmood's changelog entries
Jan 29, 2020
278f2b5
incorporate review feedback
Jan 30, 2020
d82904e
Merge pull request #7018 from hashicorp/f-e2e-specify-suite
shoenig Jan 30, 2020
e3e1f5c
core: add limits to unauthorized connections
schmichael Jan 15, 2020
b97fecc
docs: document limits
schmichael Jan 24, 2020
3589d4c
Merge pull request #160 from hashicorp/b-mtls-hostname
Jan 28, 2020
dd8fbf4
Merge pull request #7022 from hashicorp/f-handshake-deadlines-oss
schmichael Jan 30, 2020
cb9274a
Merge branch 'master' into b-tls-validation
schmichael Jan 30, 2020
f5441e6
Merge pull request #7023 from hashicorp/b-tls-validation
schmichael Jan 30, 2020
7c53d0e
docs: bump 0.10.2 -> 0.10.3
schmichael Jan 30, 2020
0cd7eea
docs: add v0.10.3 release to changelog
schmichael Jan 30, 2020
b693322
Merge pull request #7026 from hashicorp/post-0103
schmichael Jan 30, 2020
88d646b
Add an ability for client permissions
DingoEatingFuzz Jan 27, 2020
fbb137b
Refactor ability tests to use a setup hook for ability lookup
DingoEatingFuzz Jan 28, 2020
fa3a4e4
Enable the eligibility toggle conditionally based on acls
DingoEatingFuzz Jan 29, 2020
f51c0c4
Refetch all ACL things when the token changes
DingoEatingFuzz Jan 29, 2020
35a9517
New disabled buttons story
DingoEatingFuzz Jan 29, 2020
29c3cda
Disabled button styles
DingoEatingFuzz Jan 29, 2020
c6a677d
Disable options for popover and drain-popover
DingoEatingFuzz Jan 30, 2020
a89beee
hclfmt a test jobspec (#7011)
tgross Jan 31, 2020
788f64e
Merge pull request #7010 from hashicorp/doc-bulk-20200129
Jan 31, 2020
478e6d8
Update disabled 'Run Job' button to use standard disabled style
DingoEatingFuzz Jan 30, 2020
692a887
Add an explanatory tooltip to the unauthorized node drain popover
DingoEatingFuzz Jan 30, 2020
e7067f0
Fix token referencing from the token controller, as well as resetting
DingoEatingFuzz Jan 31, 2020
35d7744
Handle the case where ACLs aren't enabled in abilities
DingoEatingFuzz Jan 31, 2020
f566281
Account for disabled ACLs in ability tests
DingoEatingFuzz Jan 31, 2020
234b7ef
Acceptance test for disabled node write controls
DingoEatingFuzz Jan 31, 2020
ac696a4
Use secret ID for NOMAD_TOKEN
tiangolo Jan 31, 2020
b57d606
Merge pull request #7041 from tiangolo/patch-1
Jan 31, 2020
6e61dcf
Merge pull request #7028 from hashicorp/f-ui/node-drain-disable
DingoEatingFuzz Jan 31, 2020
87c0c92
Pass stats interval colleciton to executor
Jan 31, 2020
aec066c
changelog
Jan 31, 2020
74e10b1
Merge pull request #7043 from hashicorp/b-collection-interval
Jan 31, 2020
82b8e08
Some fixes to connection pooling
Jan 31, 2020
2f1dec2
Allow for an icon within the node status light
DingoEatingFuzz Jan 24, 2020
3d5193b
Add an icon inside the node status light
DingoEatingFuzz Jan 24, 2020
ec01c0b
Assign icons to node statuses
DingoEatingFuzz Jan 24, 2020
7f60198
New node initializing icon
DingoEatingFuzz Jan 31, 2020
e953704
Redo the node-status-light CSS to be icon-based
DingoEatingFuzz Jan 31, 2020
2e2bcc5
Add an animation for the initializing state
DingoEatingFuzz Jan 31, 2020
4419510
Call out the 'down' status too, since it's a pretty bad one
DingoEatingFuzz Jan 31, 2020
0040c75
command, docs: create and document consul token configuration for con…
shoenig Nov 18, 2019
560ce96
nomad: ensure a unique ClusterID exists when leader (gh-6702)
shoenig Nov 14, 2019
f8666bb
client: enable nomad client to request and set SI tokens for tasks
shoenig Nov 27, 2019
674ccaa
nomad: proxy requests for Service Identity tokens between Clients and…
shoenig Dec 6, 2019
6bc6a52
client: enable envoy bootstrap hook to set SI token
shoenig Dec 18, 2019
d85cccc
nomad: fixup token policy validation
shoenig Dec 19, 2019
9f48d83
nomad: handle SI token revocations concurrently
shoenig Jan 2, 2020
ead935d
agent: re-enable the server in dev mode
shoenig Jan 7, 2020
4b4dfac
client: remove unused indirection for referencing consul executable
shoenig Jan 7, 2020
e825a0f
client: skip task SI token file load failure if testing as root
shoenig Jan 7, 2020
d24d470
comments: cleanup some leftover debug comments and such
shoenig Jan 7, 2020
cc7b768
nomad,client: apply smaller PR suggestions
shoenig Jan 15, 2020
bbedeb6
nomad,client: apply more comment/style PR tweaks
shoenig Jan 15, 2020
1fca495
client: set context timeout around SI token derivation
shoenig Jan 15, 2020
40de858
client: manage TR kill from parent on SI token derivation failure
shoenig Jan 15, 2020
6152ded
nomad: fix leftover missed refactoring in consul policy checking
shoenig Jan 15, 2020
0589b65
nomad: make TaskGroup.UsesConnect helper a public helper
shoenig Jan 30, 2020
f8949dd
client: PR cleanup - shadow context variable
shoenig Jan 30, 2020
91c7dba
client: PR cleanup - improved logging around kill task in SIDS hook
shoenig Jan 30, 2020
08951ac
client: additional test cases around failures in SIDS hook
shoenig Jan 30, 2020
0f285b8
tests: skip some SIDS hook tests if running tests as root
shoenig Jan 30, 2020
6d99dd4
e2e: e2e test for connect with consul acls
shoenig Jan 13, 2020
1c9500a
e2e: remove forgotten unused field from new struct
shoenig Jan 24, 2020
d252bb4
e2e: do not use eventually when waiting for allocs
shoenig Jan 24, 2020
390a7f1
e2e: uncomment test case that is not broken
shoenig Jan 24, 2020
8372bfb
e2e: use hclfmt on consul acls policy config files
shoenig Jan 27, 2020
9fa0276
e2e: agent token was only being set for server0
shoenig Jan 27, 2020
b0e3aca
e2e: remove redundant extra API call for getting allocs
shoenig Jan 27, 2020
04b5266
e2e: setup consul ACLs a little more correctly
shoenig Jan 28, 2020
1f8e317
tests: set consul token for nomad client for testing SIDS TR hook
shoenig Jan 31, 2020
1fa5518
nomad: min cluster version for connect ACLs is now v0.10.4
shoenig Jan 31, 2020
1c15ad9
nomad: remove unused default schedular variable
shoenig Jan 31, 2020
a3476f7
docs: update chanagelog to mention connect with acls
shoenig Jan 31, 2020
37dc755
nomad/docs: increment version number to 0.10.4
shoenig Jan 31, 2020
f5eba8d
Merge pull request #7027 from hashicorp/dev-connect-acls
shoenig Feb 1, 2020
ce3d581
Merge pull request #7047 from hashicorp/f-ui/node-drain-icons
DingoEatingFuzz Feb 1, 2020
5dbccce
sentinel: copy jobs to prevent mutation
schmichael Jun 4, 2019
580baea
ignore computed diffs if node is ineligible
drewbailey Jan 23, 2020
cd00d6d
make diffSystemAllocsForNode aware of eligibility
drewbailey Jan 30, 2020
92f0a34
add test for node eligibility
drewbailey Jan 30, 2020
a880d75
comment for filtering reason
drewbailey Jan 30, 2020
e86988c
update changelog
drewbailey Feb 3, 2020
445d019
Merge pull request #7051 from hashicorp/b-copy-jobs-oss
Feb 3, 2020
c0f42dc
vagrant: disable audio interference
Feb 3, 2020
896ddf5
prehook: fix enterprise repo remote value
Feb 3, 2020
d13fe75
dev: Tweaks to cluster dev scripts
Feb 3, 2020
9ccaa92
e2e: remove leftover debug println statement
shoenig Feb 3, 2020
2e0f98c
run "make hclfmt"
Feb 3, 2020
41d5a69
make: emit explanation for /api isolation
Feb 3, 2020
3bfc7d1
pool: Clear connection before releasing
Feb 3, 2020
7f43161
Merge pull request #7054 from hashicorp/f-remove-leftover-debug-line
shoenig Feb 3, 2020
e8136c0
Merge pull request #7045 from hashicorp/b-rpc-fixes
Feb 3, 2020
39a6c63
Fix panic when monitoring a local client node
drewbailey Feb 3, 2020
4e9dc03
agent Profile req nil check s.agent.Server()
drewbailey Feb 3, 2020
173ad83
update changelog
drewbailey Feb 3, 2020
0eb3586
Merge pull request #6996 from hashicorp/system-sched-ineligible-updates
drewbailey Feb 3, 2020
bbdfd69
Merge pull request #6979 from hashicorp/f/codeowners
DingoEatingFuzz Feb 3, 2020
a1fee69
docs: fix misspelling
schmichael Feb 3, 2020
d28898b
Merge pull request #7053 from hashicorp/b-client-monitor-acl-panic
drewbailey Feb 3, 2020
f788316
keep placed canaries aligned with alloc status
drewbailey Jan 22, 2020
895e563
nomad state store must be modified through raft, rm local state change
drewbailey Jan 22, 2020
f7fb621
add state store test to ensure PlacedCanaries is updated
drewbailey Jan 22, 2020
5c43f8c
docs: add link & reorg #6690 in changelog
schmichael Feb 3, 2020
c038ee0
Merge pull request #6975 from hashicorp/b-update-placed-canaries
drewbailey Feb 3, 2020
c7eb60b
Merge pull request #7055 from hashicorp/r-dev-tweaks-20200203
Feb 3, 2020
61d4a44
docs: fix typo, ordering, & style in changelog
schmichael Feb 3, 2020
a2ee804
e2e: turn no-ACLs connect tests back on
shoenig Feb 4, 2020
18bccb2
Merge pull request #7060 from hashicorp/f-e2e-more-missed-debug
shoenig Feb 4, 2020
15a2acc
e2e: improve provisioning defaults and documentation (#7062)
tgross Feb 4, 2020
ed41d7b
e2e: rename linux runner to avoid implicit build tag (#7070)
tgross Feb 4, 2020
0f2d9ea
e2e: wait 2m rather than 10s after disabling consul acls
shoenig Feb 4, 2020
756f5c7
add e2e test for system sched ineligible nodes
drewbailey Feb 3, 2020
5c2075e
get test passing, new util func to wait for not pending
drewbailey Feb 4, 2020
3609e3a
clean up
drewbailey Feb 4, 2020
39c9c20
rm unused field
drewbailey Feb 4, 2020
8bf5016
fix check
drewbailey Feb 4, 2020
84cc906
simplify job, better error
drewbailey Feb 4, 2020
f944959
Merge pull request #7072 from hashicorp/system-sched-e2e
drewbailey Feb 4, 2020
d55c549
docs: #6065 shipped in v0.10.0, not v0.9.6
schmichael Feb 4, 2020
a74917e
Merge pull request #7074 from hashicorp/docs-changelog-6065
schmichael Feb 4, 2020
729e0c2
Merge pull request #7071 from hashicorp/b-e2e-cacls-wait-longer
shoenig Feb 4, 2020
8d17366
e2e: add --quiet flag to s3 copy to reduce log spam (#7085)
tgross Feb 6, 2020
b73ac89
Explicit transparent bg on popover actions
DingoEatingFuzz Feb 7, 2020
17e2947
Override the max-width on mobile to avoid losing space due to non-exi…
DingoEatingFuzz Feb 7, 2020
6eee8d6
Merge pull request #7098 from hashicorp/b-ui/consistent-popover-buttons
DingoEatingFuzz Feb 7, 2020
4757f87
Merge pull request #7099 from hashicorp/b-ui/mobile-styles-not-full-w…
DingoEatingFuzz Feb 7, 2020
22f7844
changelog windows binaries being signed
Feb 10, 2020
ce6b8f2
Merge pull request #7108 from hashicorp/ch-windows-binaries
Feb 10, 2020
1dd45d8
change log for remote pprof endpoints
drewbailey Feb 11, 2020
76e1785
Merge pull request #7122 from hashicorp/pprof/changelog
drewbailey Feb 11, 2020
a67710c
nomad: unset consul token on job register
shoenig Feb 12, 2020
b5b5e50
nomad: assert consul token is unset on job register in tests
shoenig Feb 12, 2020
5ccc9a6
command: use consistent CONSUL_HTTP_TOKEN name
shoenig Feb 12, 2020
7173cb2
docs: update changelog mentioning consul token passthrough
shoenig Feb 12, 2020
0a93ddd
Merge pull request #7127 from hashicorp/b-unset-ct
shoenig Feb 12, 2020
4c4dd0f
Merge pull request #7129 from hashicorp/b-consistent-ct-name
shoenig Feb 12, 2020
81c73e4
release: prep 0.10.4
nickethier Feb 19, 2020
f750636
Generate files for 0.10.4 release
hashicorp-nomad Feb 19, 2020
646df47
Release v0.10.4
hashicorp-nomad Feb 19, 2020
db3d518
merge and conflic resolving
spavell Mar 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .circleci/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/config.yml linguist-generated
1 change: 1 addition & 0 deletions .circleci/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.tmp/
80 changes: 80 additions & 0 deletions .circleci/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Set SHELL to 'strict mode' without using .SHELLFLAGS for max compatibility.
# See https://fieldnotes.tech/how-to-shell-for-compatible-makefiles/
SHELL := /usr/bin/env bash -euo pipefail -c

CIRCLECI := circleci --skip-update-check

# Set up some documentation/help message variables.
# We do not attempt to install the CircleCI CLI from this Makefile.
CCI_INSTALL_LINK := https://circleci.com/docs/2.0/local-cli/\#installation
CCI_INSTALL_MSG := Please install CircleCI CLI. See $(CCI_INSTALL_LINK)
CCI_VERSION := $(shell $(CIRCLECI) version 2> /dev/null)
ifeq ($(CCI_VERSION),)
# Attempting to use the CLI fails with installation instructions.
CIRCLECI := echo '$(CCI_INSTALL_MSG)'; exit 1; \#
endif

SOURCE_DIR := config
SOURCE_YML := $(shell [ ! -d $(SOURCE_DIR) ] || find $(SOURCE_DIR) -name '*.yml')
CONFIG_SOURCE := Makefile $(SOURCE_YML) | $(SOURCE_DIR)
OUT := config.yml
TMP := .tmp/config-processed
CONFIG_PACKED := .tmp/config-packed

default: help

help:
@echo "Usage:"
@echo " make ci-config: recompile config.yml from $(SOURCE_DIR)/"
@echo " make ci-verify: verify that config.yml is a true mapping from $(SOURCE_DIR)/"
@echo
@echo "Diagnostics:"
@[ -z "$(CCI_VERSION)" ] || echo " circleci-cli version $(CCI_VERSION)"
@[ -n "$(CCI_VERSION)" ] || echo " $(CCI_INSTALL_MSG)"

$(SOURCE_DIR):
@echo No source directory $(SOURCE_DIR) found.; exit 1

# Make sure our .tmp dir exists.
$(shell [ -d .tmp ] || mkdir .tmp)

.PHONY: ci-config
ci-config: $(OUT)

.PHONY: ci-verify
ci-verify: config-up-to-date
@$(CIRCLECI) config validate $(OUT)

define GENERATED_FILE_HEADER
### ***
### WARNING: DO NOT manually EDIT or MERGE this file, it is generated by 'make ci-config'.
### INSTEAD: Edit or merge the source in $(SOURCE_DIR)/ then run 'make ci-config'.
### ***
endef
export GENERATED_FILE_HEADER

# GEN_CONFIG writes the config to a temporary file. If the whole process succeeds,
# it then moves that file to $@. This makes is an atomic operation, so if it fails
# make doesn't consider a half-baked file up to date.
define GEN_CONFIG
@$(CIRCLECI) config pack $(SOURCE_DIR) > $(CONFIG_PACKED)
@echo "$$GENERATED_FILE_HEADER" > $@.tmp || { rm -f $@; exit 1; }
@$(CIRCLECI) config process $(CONFIG_PACKED) >> $@.tmp || { rm -f $@.tmp; exit 1; }
@mv -f $@.tmp $@
endef

$(OUT): $(CONFIG_SOURCE)
$(GEN_CONFIG)
@echo "$@ updated"

$(TMP): $(CONFIG_SOURCE)
$(GEN_CONFIG)

.PHONY: config-up-to-date
config-up-to-date: $(TMP) # Note this must not depend on $(OUT)!
@if diff config.yml $<; then \
echo "Generated $(OUT) is up to date!"; \
else \
echo "Generated $(OUT) is out of date, run make $(CONFIG) to update."; \
exit 1; \
fi
3 changes: 3 additions & 0 deletions .circleci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# How to use CircleCI multi-file config

Refer to https://github.com/hashicorp/vault/blob/master/.circleci/README.md .
Loading