Skip to content

Commit 94b8d2a

Browse files
authored
Merge pull request #13 from moodmosaic/chore/lint
Add compose file linter and workflow
2 parents 542cb35 + 6d7a968 commit 94b8d2a

6 files changed

Lines changed: 526 additions & 663 deletions

File tree

.dclintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://github.com/zavoloklom/docker-compose-linter?tab=readme-ov-file#example-configuration-file
2+
# rules: Customize which rules to apply and their severity levels (0 - Disabled, 1 - Warning, 2 - Error)
3+
rules:
4+
services-alphabetical-order: 0
5+
service-image-require-explicit-tag: 0
6+
quiet: false
7+
debug: true

.github/workflows/linter.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Lint Docker Compose
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
dclint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12+
- uses: docker-compose-linter/dclint-github-action@18659f6a7956706cb67cf9c1ad5e55f4352cbc17 # 1.6.0
13+
with:
14+
path: ./docker/docker-compose.yml
15+
recursive: true

Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ STRESS_TIMEOUT ?= 120
3030

3131
# Create the chainstate dir and extract an archive to it when the "up" target is used
3232
$(CHAINSTATE_DIR): /usr/bin/tar /usr/bin/zstd
33-
@mkdir -p $(CHAINSTATE_DIR)
34-
@if [ "$(TARGET)" = "up" ]; then
35-
if [ -f "$(CHAINSTATE_ARCHIVE)" ]; then
36-
sudo tar --same-owner -xf $(CHAINSTATE_ARCHIVE) -C $(CHAINSTATE_DIR) || exit 1
37-
else
38-
@echo "Chainstate archive ($(CHAINSTATE_ARCHIVE)) not found. Exiting"
39-
rm -rf $(CHAINSTATE_DIR)
40-
exit 1
33+
@if [ ! -d "$(CHAINSTATE_DIR)" ]; then \
34+
mkdir -p $(CHAINSTATE_DIR)
35+
@if [ "$(TARGET)" = "up" ]; then
36+
if [ -f "$(CHAINSTATE_ARCHIVE)" ]; then
37+
sudo tar --same-owner -xf $(CHAINSTATE_ARCHIVE) -C $(CHAINSTATE_DIR) || exit 1
38+
else
39+
@echo "Chainstate archive ($(CHAINSTATE_ARCHIVE)) not found. Exiting"
40+
rm -rf $(CHAINSTATE_DIR)
41+
exit 1
42+
fi
4143
fi
4244
fi
4345

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ To override the archive used to restore the network:
2020
```sh
2121
CHAINSTATE_ARCHIVE=./docker/chainsate_new.tar.zstd make up
2222
```
23+
To override the chainstate dir and resume a stopped network:
24+
*Note*: will not work for the `genesis` chainstate dir and absolute path is required
25+
```sh
26+
CHAINSTATE_DIR=$(pwd)/docker/chainsate/<existing chainstate dir> make up
27+
```
2328

2429
### Start network from genesis
2530
Creates a static chainstate folder at `./docker/chainstate/genesis`

0 commit comments

Comments
 (0)