Skip to content

Commit dfae391

Browse files
committed
Updated to build configs and scripts to match other repos' style
1 parent 7cbd41b commit dfae391

File tree

4 files changed

+46
-50
lines changed

4 files changed

+46
-50
lines changed

.travis.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@ env:
66
global:
77
- REPO=docksal/solr
88

9-
env:
109
matrix:
1110
- VERSION=7.5.0 SOLR_DEFAULT_CONFIG_SET=search_api_solr_8.x-2.0 TAGS=7.5,7,latest
1211
- VERSION=6.6.5 SOLR_DEFAULT_CONFIG_SET=search_api_solr_8.x-2.0 TAGS=6.6,6
1312
- VERSION=5.5.5 SOLR_DEFAULT_CONFIG_SET=search_api_solr_8.x-1.2 TAGS=5.5,5
1413

14+
install:
15+
# Install Docksal to have a matching versions of Docker on the build host
16+
- curl -fsSL https://get.docksal.io | bash
17+
- fin version
18+
- fin sysinfo
19+
1520
script:
1621
- make
1722
- make test
1823

1924
after_success:
20-
- "${TRAVIS_BUILD_DIR}/scripts/release.sh"
25+
- ${TRAVIS_BUILD_DIR}/release.sh
2126

2227
after_failure:
2328
- make logs

Makefile

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
-include env_make
22

33
VERSION ?= 7.5.0
4-
SOLR_DEFAULT_CONFIG_SET ?= search_api_solr_8.x-2.0
4+
TAG ?= $(VERSION)
55

66
REPO ?= docksal/solr
77
NAME = docksal-solr-$(VERSION)
8-
TAG ?= $(VERSION)
8+
SOLR_DEFAULT_CONFIG_SET ?= search_api_solr_8.x-2.0
99

1010
ifneq ($(STABILITY_TAG),)
11-
ifneq ($(TAG),latest)
12-
override TAG := $(TAG)-$(STABILITY_TAG)
13-
endif
11+
ifneq ($(TAG),latest)
12+
override TAG := $(TAG)-$(STABILITY_TAG)
13+
endif
1414
endif
1515

1616
.PHONY: build test push shell run start stop logs clean release
@@ -20,15 +20,15 @@ build:
2020
docker build -t $(REPO):$(TAG) --build-arg VERSION=$(VERSION) --build-arg SOLR_DEFAULT_CONFIG_SET=$(SOLR_DEFAULT_CONFIG_SET) .
2121

2222
test:
23-
IMAGE=$(REPO):$(TAG) NAME=$(NAME) VERSION=$(VERSION) bats ./tests/test.bats
23+
IMAGE=$(REPO):$(TAG) NAME=$(NAME) VERSION=$(VERSION) ./tests/test.bats
2424

2525
push:
2626
docker push $(REPO):$(TAG)
2727

28-
shell:
28+
shell: clean
2929
docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) /bin/bash
3030

31-
run:
31+
run: clean
3232
docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG)
3333

3434
start: clean

scripts/release.sh release.sh

File renamed without changes.

tests/test.bats

+31-40
Original file line numberDiff line numberDiff line change
@@ -3,68 +3,59 @@
33
# Debugging
44
teardown () {
55
echo
6-
# TODO: figure out how to deal with this (output from previous run commands showing up along with the error message)
7-
echo "Note: ignore the lines between \"...failed\" above and here"
8-
echo
9-
echo "Status: $status"
106
echo "Output:"
117
echo "================================================================"
12-
echo "$output"
8+
echo "${output}"
139
echo "================================================================"
1410
}
1511

1612
# Checks container health status (if available)
1713
# @param $1 container id/name
1814
_healthcheck ()
1915
{
20-
local health_status
21-
health_status=$(docker inspect --format='{{json .State.Health.Status}}' "$1" 2>/dev/null)
16+
local health_status
17+
health_status=$(docker inspect --format='{{json .State.Health.Status}}' "$1" 2>/dev/null)
2218

23-
# Wait for 5s then exit with 0 if a container does not have a health status property
24-
# Necessary for backward compatibility with images that do not support health checks
25-
if [[ $? != 0 ]]; then
26-
echo "Waiting 10s for container to start..."
27-
sleep 10
28-
return 0
29-
fi
19+
# Wait for 5s then exit with 0 if a container does not have a health status property
20+
# Necessary for backward compatibility with images that do not support health checks
21+
if [[ $? != 0 ]]; then
22+
echo "Waiting 10s for container to start..."
23+
sleep 10
24+
return 0
25+
fi
3026

31-
# If it does, check the status
32-
echo $health_status | grep '"healthy"' >/dev/null 2>&1
27+
# If it does, check the status
28+
echo $health_status | grep '"healthy"' >/dev/null 2>&1
3329
}
3430

3531
# Waits for containers to become healthy
36-
# For reasoning why we are not using `depends_on` `condition` see here:
37-
# https://github.com/docksal/docksal/issues/225#issuecomment-306604063
3832
_healthcheck_wait ()
3933
{
40-
# Wait for cli to become ready by watching its health status
41-
local container_name="${NAME}"
42-
local delay=5
43-
local timeout=30
44-
local elapsed=0
34+
# Wait for cli to become ready by watching its health status
35+
local container_name="${NAME}"
36+
local delay=5
37+
local timeout=30
38+
local elapsed=0
4539

46-
until _healthcheck "$container_name"; do
47-
echo "Waiting for $container_name to become ready..."
48-
sleep "$delay";
40+
until _healthcheck "$container_name"; do
41+
echo "Waiting for $container_name to become ready..."
42+
sleep "$delay";
4943

50-
# Give the container 30s to become ready
51-
elapsed=$((elapsed + delay))
52-
if ((elapsed > timeout)); then
53-
echo-error "$container_name heathcheck failed" \
54-
"Container did not enter a healthy state within the expected amount of time." \
55-
"Try ${yellow}fin restart${NC}"
56-
exit 1
57-
fi
58-
done
44+
# Give the container 30s to become ready
45+
elapsed=$((elapsed + delay))
46+
if ((elapsed > timeout)); then
47+
echo "$container_name heathcheck failed"
48+
exit 1
49+
fi
50+
done
5951

60-
return 0
52+
return 0
6153
}
6254

63-
# Global skip
64-
# Uncomment below, then comment skip in the test you want to debug. When done, reverse.
65-
#SKIP=1
55+
# To work on a specific test:
56+
# run `export SKIP=1` locally, then comment skip in the test you want to debug
6657

67-
@test "Bare server" {
58+
@test "Bare service" {
6859
[[ $SKIP == 1 ]] && skip
6960

7061
### Setup ###

0 commit comments

Comments
 (0)