From a29ee641faecf7e55c92d429931c776d6a655abd Mon Sep 17 00:00:00 2001 From: Adrian Montagu <168636369+AdrianMontaguSmartDCSIT@users.noreply.github.com> Date: Fri, 17 May 2024 09:37:12 +0100 Subject: [PATCH] Update dockerfile and install_repositories.sh for open source (#21) --- Dockerfile | 10 +++------- scripts/install_repositories.sh | 32 ++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index dfa9fbf..08dff04 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,22 +3,18 @@ FROM python:3.11-slim-bullseye # install pre-requisites and setup folders RUN apt-get update && yes "yes" | apt-get upgrade && \ - yes "yes" | apt-get install openssh-client && \ yes "yes" | apt-get install git && \ - mkdir -p -m 0600 /root/.ssh/ && \ - touch /root/.ssh/known_hosts && \ - ssh-keyscan gitlab.com >> /root/.ssh/known_hosts && \ - ssh-keyscan github.com >> /root/.ssh/known_hosts && \ mkdir /test_harness_app && \ mkdir /config -RUN --mount=type=ssh pip install git+ssh://git@github.com/SmartDCSITlimited/test-event-generator.git +# Install python package test-event-generator from open source repo +RUN pip install git+https://github.com/xtuml/janus.git WORKDIR /test_harness_app COPY . /test_harness_app/ -RUN --mount=type=ssh chmod +x /test_harness_app/scripts/install_repositories.sh && \ +RUN chmod +x /test_harness_app/scripts/install_repositories.sh && \ /test_harness_app/scripts/install_repositories.sh && \ pip install -r requirements.txt diff --git a/scripts/install_repositories.sh b/scripts/install_repositories.sh index ac996f0..45e7a8e 100755 --- a/scripts/install_repositories.sh +++ b/scripts/install_repositories.sh @@ -1,29 +1,41 @@ #!/bin/sh -# test event generator +# Set janus (test-event-generator) version tag +export janus_tag=v1.0.0 + +# clone janus repo cd /tmp/ -if git clone git@github.com:SmartDCSITlimited/test-event-generator.git; then +if git clone https://github.com/xtuml/janus.git; then ERROR="" else - ERROR="$(git clone git@github.com:SmartDCSITlimited/test-event-generator.git 2>&1 1>/dev/null)" + ERROR="$(git clone https://github.com/xtuml/janus.git 2>&1 1>/dev/null)" fi + +# check if clone was successful if [ -z "$ERROR" ]; then - echo "test-event-generator cloned successfully" + echo "janus (test-event-generator) cloned successfully" else if [ "$ERROR" == *"fatal: Could not read from remote repository"* ]; then - echo "test-event-generator clone failed functionality will not be present in Test Harness.\nIf this is not expected get ssh access to rhe repository:\ngit@github.com:SmartDCSITlimited/test-event-generator.git\n" + echo "janus (test-event-generator) clone failed functionality will not be present in Test Harness." exit 0 else - >&2 echo "test-event-generator clone failed with error message:\n$ERROR" + >&2 echo "janus (test-event-generator) clone failed with error message:\n$ERROR" exit 1 fi fi -# fail if anything errors + +# fail if errors are encountered set -e -cd test-event-generator + +# navigate to cloned repo and checkout specified version +cd janus git fetch --all --tags -git checkout tags/v1.0.0 -b latest +git checkout tags/$janus_tag -b latest + +# install dependencies and the package pip install -r requirements.txt pip install . + +# clean up cd .. -rm -f -r test-event-generator/ \ No newline at end of file +rm -f -r janus/ \ No newline at end of file