Skip to content

Commit

Permalink
Use make image to build image
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminPelletier committed Oct 19, 2023
1 parent ba6597c commit 6d17e9c
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 61 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ json-schema-lint:
.PHONY: hygiene-tests
hygiene-tests: check-hygiene

.PHONY: build-monitoring
build-monitoring:
cd monitoring && make build
.PHONY: image
image:
cd monitoring && make image

tag:
scripts/tag.sh $(UPSTREAM_OWNER)/monitoring/v$(VERSION)
Expand Down
5 changes: 4 additions & 1 deletion monitoring/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
report.json
config.json
run_locally_list.txt
run_locally_scd_deploy_others.sh
run_locally_scd_deploy_others.sh

# Make target placeholders
image
4 changes: 2 additions & 2 deletions monitoring/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ format:
cd monitorlib && make format
cd prober && make format

.PHONY: build
build:
image: ../requirements.txt $(shell find . -type f ! -path "*/output/*" ! -name image) $(shell find ../interfaces -type f)
# Building image due to changes in the following files: $?
./build.sh

.PHONY: test
Expand Down
7 changes: 3 additions & 4 deletions monitoring/atproxy/run_locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ else
fi
cd "${BASEDIR}/../.." || exit 1

if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
monitoring/build.sh || exit 1
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

CLIENT_BASIC_AUTH="local_client:local_client"
PUBLIC_KEY="/var/test-certs/auth2.pem"
Expand Down
1 change: 1 addition & 0 deletions monitoring/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ docker image build \
--build-arg commit_hash="$(git rev-parse HEAD)" \
. \
|| exit 1
touch monitoring/image
18 changes: 13 additions & 5 deletions monitoring/mock_uss/run_locally_msgsigning.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/usr/bin/env bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
"${SCRIPT_DIR}/../build.sh" || exit 1
export DO_NOT_BUILD_MONITORING=true
# Find and change to repo root directory
OS=$(uname)
if [[ "$OS" == "Darwin" ]]; then
# OSX uses BSD readlink
BASEDIR="$(dirname "$0")"
else
BASEDIR=$(readlink -e "$(dirname "$0")")
fi
cd "${BASEDIR}/../.." || exit 1

cd monitoring
make image
cd ..

AUTH="DummyOAuth(http://host.docker.internal:8085/token,uss1)"
DSS="http://host.docker.internal:8082"
Expand Down Expand Up @@ -32,7 +40,7 @@ docker run ${docker_args} --name ${container_name} \
-e MOCK_USS_BASE_URL="${BASE_URL}" \
-e MOCK_USS_SERVICES="scdsc,msgsigning" \
-p ${PORT}:5000 \
-v "${SCRIPT_DIR}/../../build/test-certs:/var/test-certs:ro" \
-v "$(pwd)/build/test-certs:/var/test-certs:ro" \
"$@" \
interuss/monitoring \
mock_uss/start.sh
18 changes: 13 additions & 5 deletions monitoring/mock_uss/run_locally_test_geoawareness.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/usr/bin/env bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
"${SCRIPT_DIR}/../build.sh" || exit 1
export DO_NOT_BUILD_MONITORING=true
# Find and change to repo root directory
OS=$(uname)
if [[ "$OS" == "Darwin" ]]; then
# OSX uses BSD readlink
BASEDIR="$(dirname "$0")"
else
BASEDIR=$(readlink -e "$(dirname "$0")")
fi
cd "${BASEDIR}/../.." || exit 1

cd monitoring
make image
cd ..

PUBLIC_KEY="/var/test-certs/auth2.pem"
container_name="mock_uss_geoawareness_test"
Expand All @@ -27,7 +35,7 @@ docker run ${docker_args} --rm --name ${container_name} \
-e MOCK_USS_TOKEN_AUDIENCE="${AUD}" \
-e MOCK_USS_SERVICES="geoawareness" \
-p ${PORT}:5000 \
-v "${SCRIPT_DIR}/../../build/test-certs:/var/test-certs:ro" \
-v "$(pwd)/build/test-certs:/var/test-certs:ro" \
"$@" \
interuss/monitoring \
${docker_command}
7 changes: 3 additions & 4 deletions monitoring/mock_uss/start_all_local_mocks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ else
fi
cd "${BASEDIR}/../.." || exit 1

if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
./monitoring/build.sh || exit 1
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

./monitoring/mock_uss/run_locally.sh up -d

Expand Down
2 changes: 1 addition & 1 deletion monitoring/prober/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ First, build the monitoring image:

(from the repo root)
```shell script
monitoring/build.sh
make image
```

...then run prober:
Expand Down
7 changes: 3 additions & 4 deletions monitoring/prober/run_locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ else
fi
cd "${BASEDIR}/../.." || exit 1

if [ -z "$DO_NOT_BUILD_MONITORING" ]; then
monitoring/build.sh || exit 1
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

CORE_SERVICE_CONTAINER="local_infra-dss-1"
OAUTH_CONTAINER="local_infra-oauth-1"
Expand Down
7 changes: 3 additions & 4 deletions monitoring/uss_qualifier/bin/generate_rid_test_definition.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ else
fi
cd "${BASEDIR}/../../.." || exit 1

if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
monitoring/build.sh || exit 1
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

CONFIG_LOCATION="monitoring/uss_qualifier/config_run_locally.json"
CONFIG='--config config_run_locally.json'
Expand Down
7 changes: 3 additions & 4 deletions monitoring/uss_qualifier/bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ AUTH="${2:-NoAuth()}"

QUALIFIER_OPTIONS="--auth $AUTH --config /config.json --report output/report.json"

if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
"$(pwd)"/monitoring/build.sh
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

if [ "$CI" == "true" ]; then
docker_args="--add-host host.docker.internal:host-gateway" # Required to reach other containers in Ubuntu (used for Github Actions)
Expand Down
7 changes: 3 additions & 4 deletions monitoring/uss_qualifier/run_locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ else
fi
cd "${BASEDIR}/../.." || exit 1

if [ -z "$DO_NOT_BUILD_MONITORING" ]; then
monitoring/build.sh || exit 1
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

CONFIG_NAME="${1:-ALL}"

Expand Down
7 changes: 3 additions & 4 deletions monitoring/uss_qualifier/scripts/format_test_documentation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ else
fi
cd "${BASEDIR}/../../.." || exit 1

if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
monitoring/build.sh || exit 1
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

# shellcheck disable=SC2086
docker run --name test_documentation_formatter \
Expand Down
7 changes: 3 additions & 4 deletions monitoring/uss_qualifier/scripts/format_test_suite_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ else
fi
cd "${BASEDIR}/../../.." || exit 1

if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
monitoring/build.sh || exit 1
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

# shellcheck disable=SC2086
docker run --name test_suite_docs_formatter \
Expand Down
7 changes: 3 additions & 4 deletions monitoring/uss_qualifier/scripts/run_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ else
fi
cd "${BASEDIR}/../../.." || exit 1

if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
monitoring/build.sh || exit 1
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

# shellcheck disable=SC2086
docker run --name uss_qualifier_unit_test \
Expand Down
7 changes: 3 additions & 4 deletions monitoring/uss_qualifier/scripts/validate_test_definitions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ else
fi
cd "${BASEDIR}/../../.." || exit 1

if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
monitoring/build.sh || exit 1
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

# shellcheck disable=SC2086
docker run --name test_definition_validator \
Expand Down
7 changes: 3 additions & 4 deletions schemas/manage_type_schemas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ else
fi
cd "${BASEDIR}/.." || exit 1

if [ -z "${DO_NOT_BUILD_MONITORING}" ]; then
monitoring/build.sh || exit 1
export DO_NOT_BUILD_MONITORING=true
fi
cd monitoring
make image
cd ..

action=${1:?The action must be specified as --check or --generate}

Expand Down

0 comments on commit 6d17e9c

Please sign in to comment.