|
| 1 | +#!/bin/bash |
| 2 | +# Check script is running in contract-tests |
| 3 | +current_path=`pwd` |
| 4 | +current_dir="${current_path##*/}" |
| 5 | +if [ "$current_dir" != "contract-tests" ]; then |
| 6 | + echo "Please run from contract-tests dir" |
| 7 | + exit |
| 8 | +fi |
| 9 | + |
| 10 | +# Remove old whl files (excluding distro whl) |
| 11 | +rm -rf dist/mock_collector* |
| 12 | +rm -rf dist/contract_tests* |
| 13 | + |
| 14 | +# Create mock-collector image |
1 | 15 | cd images/mock-collector
|
2 | 16 | docker build . -t aws-appsignals-mock-collector-python
|
| 17 | +cd ../.. |
| 18 | + |
| 19 | +# Find and store aws_opentelemetry_distro whl file |
| 20 | +cd dist |
| 21 | +DISTRO=(aws_opentelemetry_distro*.whl) |
| 22 | +if [ "$DISTRO" = "aws_opentelemetry_distro*.whl" ]; then |
| 23 | + echo "Could not find aws_opentelemetry_distro whl file in dist dir." |
| 24 | + exit 1 |
| 25 | +fi |
3 | 26 | cd ..
|
4 | 27 |
|
5 |
| -cd applications |
6 |
| -for dir in */ |
| 28 | +# Create application images |
| 29 | +for dir in images/applications/* |
7 | 30 | do
|
8 |
| - cd $dir |
9 |
| - docker build . -t aws-appsignals-tests-${dir%/}-app |
10 |
| - cd .. |
| 31 | + application="${dir##*/}" |
| 32 | + docker build . -t aws-appsignals-tests-${application}-app -f ${dir}/Dockerfile --build-arg="DISTRO=${DISTRO}" |
11 | 33 | done
|
12 | 34 |
|
13 |
| -cd ../.. |
14 |
| - |
15 |
| -mkdir dist |
16 |
| -rm -rf dist/* |
| 35 | +# Build and install mock-collector |
17 | 36 | cd images/mock-collector
|
18 | 37 | python3 -m build --outdir ../../dist --no-isolation
|
19 | 38 | cd ../../dist
|
20 |
| -pip wheel --no-deps mock_collector-1.0.0.tar.gz |
21 | 39 | pip install mock_collector-1.0.0-py3-none-any.whl --force-reinstall
|
22 | 40 |
|
| 41 | +# Build and install contract-tests |
23 | 42 | cd ../tests
|
24 | 43 | python3 -m build --outdir ../dist --no-isolation
|
25 | 44 | cd ../dist
|
26 |
| -pip wheel --no-deps contract_tests-1.0.0.tar.gz |
27 | 45 | # --force-reinstall causes `ERROR: No matching distribution found for mock-collector==1.0.0`, but uninstalling and reinstalling works pretty reliably.
|
28 | 46 | pip uninstall contract-tests -y
|
29 | 47 | pip install contract_tests-1.0.0-py3-none-any.whl
|
|
0 commit comments