-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM python:3-alpine | ||
|
||
ARG git_version | ||
|
||
COPY . /awslimitchecker | ||
RUN cd /awslimitchecker && pip install -e . | ||
|
||
LABEL org.opencontainers.image.revision=$git_version \ | ||
org.opencontainers.image.source="https://github.com/jantman/awslimitchecker.git" \ | ||
org.opencontainers.image.url="https://github.com/jantman/awslimitchecker" \ | ||
org.opencontainers.image.authors="[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sut: | ||
build: . | ||
environment: | ||
AWS_DEFAULT_REGION: us-east-1 | ||
command: /usr/local/bin/awslimitchecker --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash -x | ||
|
||
set -x | ||
set -e | ||
|
||
if [ -z "$1" ]; then | ||
>&2 echo "USAGE: docker_build.sh [build|dockerbuild|push|dockerbuildtest]" | ||
exit 1 | ||
fi | ||
|
||
function gettag { | ||
# if it's a build of a tag, return that right away | ||
[ ! -z "$TRAVIS_TAG" ] && { echo $TRAVIS_TAG; return 0; } | ||
# otherwise, prefix with PR number if available | ||
prefix='' | ||
[ ! -z "$TRAVIS_PULL_REQUEST" ] && [[ "$TRAVIS_PULL_REQUEST" != "false" ]] && prefix="PR${TRAVIS_PULL_REQUEST}_" | ||
ref="test_${prefix}$(git rev-parse --short HEAD)_$(date +%s)" | ||
echo "${ref}" | ||
} | ||
|
||
function getversion { | ||
python -c 'from awslimitchecker.version import _VERSION; print(_VERSION)' | ||
} | ||
|
||
function getbuildurl { | ||
[ ! -z "$TRAVIS_BUILD_WEB_URL" ] && { echo $TRAVIS_BUILD_WEB_URL; return 0; } | ||
echo "local" | ||
} | ||
|
||
function dockertoxbuild { | ||
tag=$(gettag) | ||
version=$(getversion) | ||
buildurl=$(getbuildurl) | ||
echo "Building Docker image..." | ||
docker build \ | ||
--build-arg git_version="$(git rev-parse --short HEAD)" \ | ||
--no-cache \ | ||
-t "jantman/awslimitchecker:${tag}" . | ||
echo "Built image and tagged as: jantman/awslimitchecker:${tag}" | ||
} | ||
|
||
function dockerbuildtest { | ||
tag=$(gettag) | ||
dockertoxbuild | ||
./dockertest.sh "jantman/awslimitchecker:${tag}" | ||
} | ||
|
||
if [[ "$1" == "dockerbuild" ]]; then | ||
dockertoxbuild | ||
elif [[ "$1" == "dockerbuildtest" ]]; then | ||
dockerbuildtest | ||
else | ||
>&2 echo "USAGE: do_docker.sh [dockerbuild|dockerbuildtest]" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -x | ||
|
||
set -x | ||
set -e | ||
|
||
if [ -z "$1" ]; then | ||
>&2 echo "USAGE: dockertest.sh repo/image:tag" | ||
exit 1 | ||
fi | ||
|
||
docker run -it --rm -e AWS_DEFAULT_REGION=us-east-1 "$1" /usr/local/bin/awslimitchecker --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters