From eb6f968c36d8a18dfb27962bd6911281e518ba6c Mon Sep 17 00:00:00 2001 From: Max Siegieda Date: Tue, 13 Nov 2018 17:01:00 +0000 Subject: [PATCH] add basic fake implementation of sdaccel-builder for testing (#266) * build fake-sdaccel-builder image for fake-batch testing --- docker-compose.on-prem.yml | 4 ++++ fake-sdaccel-builder/Dockerfile | 6 ++++++ fake-sdaccel-builder/aws/build.sh | 23 +++++++++++++++++++++++ fake-sdaccel-builder/aws/graph.sh | 21 +++++++++++++++++++++ fake-sdaccel-builder/aws/simulate.sh | 19 +++++++++++++++++++ 5 files changed, 73 insertions(+) create mode 100644 fake-sdaccel-builder/Dockerfile create mode 100755 fake-sdaccel-builder/aws/build.sh create mode 100755 fake-sdaccel-builder/aws/graph.sh create mode 100755 fake-sdaccel-builder/aws/simulate.sh diff --git a/docker-compose.on-prem.yml b/docker-compose.on-prem.yml index 0ea9a197..57589c71 100644 --- a/docker-compose.on-prem.yml +++ b/docker-compose.on-prem.yml @@ -101,6 +101,10 @@ services: - RECO_FEATURE_DEP_QUEUE=1 - RECO_PUBLIC_PROJECT_ID=a95550bf-bffa-42df-b100-872501940c5c + fake-sdaccel-builder: + build: ./fake-sdaccel-builder + image: fake-sdaccel-builder:latest + networks: platform: driver: bridge diff --git a/fake-sdaccel-builder/Dockerfile b/fake-sdaccel-builder/Dockerfile new file mode 100644 index 00000000..7be7c82e --- /dev/null +++ b/fake-sdaccel-builder/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine:3.8 + +RUN apk add bash curl + +COPY aws/*.sh /opt/ +WORKDIR /mnt diff --git a/fake-sdaccel-builder/aws/build.sh b/fake-sdaccel-builder/aws/build.sh new file mode 100755 index 00000000..19ff228b --- /dev/null +++ b/fake-sdaccel-builder/aws/build.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +function post_event { + curl -XPOST -H "Content-Type: application/json" -d '{"status": "'"$1"'", "message": "'"$2"'", "code": '${3-0}'}' "$CALLBACK_URL" &> /dev/null +} + +post_event STARTED + +echo "downloading source code... done" + +echo "compiling host cmds... done" + +echo "compiling fpga kernel..." + +for i in $(seq 1 100) + do echo $i% + sleep 1 +done + +echo "uploading artifacts... done" + +post_event COMPLETED diff --git a/fake-sdaccel-builder/aws/graph.sh b/fake-sdaccel-builder/aws/graph.sh new file mode 100755 index 00000000..a23cfad1 --- /dev/null +++ b/fake-sdaccel-builder/aws/graph.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -e + +function post_event { + curl -XPOST -H "Content-Type: application/json" -d '{"status": "'"$1"'", "message": "'"$2"'", "code": '${3-0}'}' "$CALLBACK_URL" &> /dev/null +} + +post_event STARTED + +echo "downloading source code... done" + +echo "generating graph..." + +for i in $(seq 1 100) + do echo $i% + sleep 1 +done + +echo "uploading graph... done" + +post_event COMPLETED diff --git a/fake-sdaccel-builder/aws/simulate.sh b/fake-sdaccel-builder/aws/simulate.sh new file mode 100755 index 00000000..7431ca15 --- /dev/null +++ b/fake-sdaccel-builder/aws/simulate.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +function post_event { + curl -XPOST -H "Content-Type: application/json" -d '{"status": "'"$1"'", "message": "'"$2"'", "code": '${3-0}'}' "$CALLBACK_URL" &> /dev/null +} + +post_event STARTED + +echo "downloading source code... done" + +echo "running simulation..." + +for i in $(seq 1 100) + do echo $i% + sleep 1 +done + +post_event COMPLETED