This repository was archived by the owner on Jan 31, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +70
-28
lines changed
Expand file tree Collapse file tree 4 files changed +70
-28
lines changed Original file line number Diff line number Diff line change 1+ # Builder Stage
12FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 as builder
23
34ENV LANG=en_US.utf8
@@ -20,11 +21,11 @@ RUN microdnf update \
2021 && if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3.9 /usr/bin/python; fi \
2122 && if [ ! -e /usr/bin/pip ]; then ln -s /usr/bin/pip3.9 /usr/bin/pip ; fi \
2223 && pip install -U pip \
23- && pip install poetry \
24+ && pip install poetry tox \
2425 && poetry config virtualenvs.in-project true \
2526 && poetry install -n --no-dev
2627
27-
28+ # Release Stage
2829FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 as release
2930
3031ENV LANG=en_US.utf8
@@ -47,3 +48,14 @@ COPY houndigrade/cli.py .
4748
4849ENTRYPOINT ["python" , "cli.py" ]
4950CMD ["--help" ]
51+
52+ # PR Check Stage
53+ FROM builder as pr_check
54+
55+ COPY tox.ini .
56+ COPY houndigrade/ houndigrade/
57+
58+ RUN tox
59+
60+ # Decalre "default" stage.
61+ FROM release
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ DOCKER_CONF=" ${PWD} /.docker"
4+
5+ IMAGE_NAME=" quay.io/cloudservices/houndigrade"
6+ GIT_TAG=$( git describe --tags $( git rev-list --tags --max-count=1) )
7+
8+ if [[ -z " $QUAY_USER " || -z " $QUAY_TOKEN " ]]; then
9+ echo " QUAY_USER and QUAY_TOKEN must be set"
10+ exit 1
11+ fi
12+
13+ if [[ -z " $RH_REGISTRY_USER " || -z " $RH_REGISTRY_TOKEN " ]]; then
14+ echo " RH_REGISTRY_USER and RH_REGISTRY_TOKEN must be set"
15+ exit 1
16+ fi
17+
18+ mkdir -p " ${DOCKER_CONF} "
19+
20+ # Log into the registries
21+ docker --config=" ${DOCKER_CONF} " login -u=" ${QUAY_USER} " -p=" ${QUAY_TOKEN} " quay.io
22+ docker --config=" ${DOCKER_CONF} " login -u=" $RH_REGISTRY_USER " -p=" $RH_REGISTRY_TOKEN " registry.redhat.io
23+
24+ # Check if semver tagged image already exists, or this is the first build of it.
25+ if [[ ! " docker --config=" ${DOCKER_CONF} " pull ${IMAGE_NAME} :${GIT_TAG} " ]]; then
26+ echo " First time encountering ${GIT_TAG} , building..."
27+ push_git_tag=true
28+ else
29+ echo " ${GIT_TAG} already exists, skipping building tag."
30+ fi
31+
32+ # Pull 'Latest' Image
33+ docker --config=" ${DOCKER_CONF} " pull ${IMAGE_NAME} :latest || true
34+
35+ # Build and Tag
36+ docker --config=" ${DOCKER_CONF} " build --cache-from ${IMAGE_NAME} :latest --tag " ${IMAGE_NAME} :latest" .
37+ if [[ " $push_git_tag " = true ]]; then
38+ docker --config=" ${DOCKER_CONF} " tag " ${IMAGE_NAME} :latest" " ${IMAGE_NAME} :${GIT_TAG} "
39+ fi
40+
41+ # Push images
42+ docker --config=" ${DOCKER_CONF} " push " ${IMAGE_NAME} :latest"
43+ if [[ " $push_git_tag " = true ]]; then
44+ docker --config=" ${DOCKER_CONF} " push " ${IMAGE_NAME} :${GIT_TAG} "
45+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Run the PR Check build stage
4+ docker build --target pr_check .
5+
6+ mkdir -p artifacts
7+ cat << EOF > artifacts/junit-dummy.xml
8+ <testsuite tests="1">
9+ <testcase classname="dummy" name="dummytest"/>
10+ </testsuite>
11+ EOF
You can’t perform that action at this time.
0 commit comments