sonar stage after build stage

This commit is contained in:
Matthias Bisping 2022-04-19 19:05:50 +02:00
parent e988ada236
commit 5094015a87
3 changed files with 11 additions and 28 deletions

View File

@ -74,7 +74,8 @@ public class PlanSpec {
SERVICE_NAME, new BambooKey(SERVICE_KEY))
.description("Docker build for image-prediction.")
// .variables()
.stages(new Stage("Build Stage")
.stages(
new Stage("Build Stage")
.jobs(
new Job("Build Job", new BambooKey("BUILD"))
.tasks(
@ -102,7 +103,9 @@ public class PlanSpec {
.dockerConfiguration(
new DockerConfiguration()
.image("nexus.iqser.com:5001/infra/release_build:4.2.0")
.volume("/var/run/docker.sock", "/var/run/docker.sock")),
.volume("/var/run/docker.sock", "/var/run/docker.sock"))),
new Stage("Sonar Stage")
.jobs(
new Job("Sonar Job", new BambooKey("SONAR"))
.tasks(
new CleanWorkingDirectoryTask()
@ -111,9 +114,6 @@ public class PlanSpec {
new VcsCheckoutTask()
.description("Checkout default repository.")
.checkoutItems(new CheckoutItem().defaultRepository()),
new VcsCheckoutTask()
.description("Checkout redai_image repository.")
.checkoutItems(new CheckoutItem().repository("RR / redai_image").path("redai_image")),
new ScriptTask()
.description("Set config and keys.")
.inlineBody("mkdir -p ~/.ssh\n" +
@ -125,7 +125,12 @@ public class PlanSpec {
.description("Run Sonarqube scan.")
.location(Location.FILE)
.fileFromPath("bamboo-specs/src/main/resources/scripts/sonar-scan.sh")
.argument(SERVICE_NAME))
.argument(SERVICE_NAME),
new ScriptTask()
.description("Shut down any running docker containers.")
.location(Location.FILE)
.inlineBody("pip install docker-compose\n" +
"docker-compose down"))
.dockerConfiguration(
new DockerConfiguration()
.image("nexus.iqser.com:5001/infra/release_build:4.2.0")

View File

@ -1,15 +0,0 @@
#!/bin/bash
set -e
python3 -m venv build_venv
source build_venv/bin/activate
python3 -m pip install --upgrade pip
pip install dvc
pip install 'dvc[ssh]'
dvc pull
git submodule update --init --recursive
docker build -f Dockerfile_base -t image-prediction-base .
docker build -f Dockerfile -t image-prediction .

View File

@ -76,11 +76,7 @@ def server_process(server, host_and_port, url):
server.close()
# TODO: Make tests run on build server
@pytest.mark.parametrize("server_type", ["actual"])
@pytest.mark.xfail(reason="Fails in build server for whatever reason")
def test_server_predict(url, real_pdf, real_expected_service_response):
response = requests.post(f"{url}/predict", data=real_pdf)
response.raise_for_status()
@ -88,7 +84,6 @@ def test_server_predict(url, real_pdf, real_expected_service_response):
@pytest.mark.parametrize("server_type", ["dummy"])
@pytest.mark.xfail(reason="Fails in build server for whatever reason")
def test_server_dummy_operation(url):
response = requests.post(f"{url}/predict", data=b"42")
response.raise_for_status()
@ -96,7 +91,6 @@ def test_server_dummy_operation(url):
@pytest.mark.parametrize("server_type", ["dummy"])
@pytest.mark.xfail(reason="Fails in build server for whatever reason")
def test_server_health_check(url):
response = requests.get(f"{url}/health")
response.raise_for_status()
@ -104,6 +98,5 @@ def test_server_health_check(url):
@pytest.mark.parametrize("server_type", ["dummy"])
@pytest.mark.xfail(reason="Fails in build server for whatever reason")
def test_server_ready_check(url):
assert server_ready(url)