From 291febe82c3afdcdd356864748c163b43b411c3f Mon Sep 17 00:00:00 2001 From: Begona Guereca Date: Thu, 4 Aug 2022 17:26:12 +0000 Subject: [PATCH] Updated start up script --- .devcontainer/devcontainer.json | 2 +- .devcontainer/setupcodespace.sh | 12 ++++++++++++ .devcontainer/setupjenkins.sh | 17 ----------------- 3 files changed, 13 insertions(+), 18 deletions(-) delete mode 100644 .devcontainer/setupjenkins.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8c3f8c2..9bdc2e9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,5 +18,5 @@ "ms-azuretools.vscode-docker", ], "onCreateCommand": 'echo "export GITHUB_ACCESS_TOKEN=$VALET_GHCR_PASSWORD" >> ~/.bashrc', - "postCreateCommand": "sudo bash .devcontainer/setupcodespace.sh ${VALET_GHCR_PASSWORD} ${AZURE_DEVOPS_PROJECT} ${AZURE_DEVOPS_ORGANIZATION} ${AZURE_DEVOPS_ACCESS_TOKEN} ${GITHUB_USER} 'https://github.com/' && gh extension install github/gh-valet || echo 'Could not auto-build. Skipping.' " + "postCreateCommand": "sudo bash .devcontainer/setupcodespace.sh ${VALET_GHCR_PASSWORD} ${AZURE_DEVOPS_PROJECT} ${AZURE_DEVOPS_ORGANIZATION} ${AZURE_DEVOPS_ACCESS_TOKEN} ${GITHUB_USER} ${JENKINS_USERNAME} ${JENKINS_PASSWORD}'https://github.com/' && gh extension install github/gh-valet || echo 'Could not auto-build. Skipping.' " } diff --git a/.devcontainer/setupcodespace.sh b/.devcontainer/setupcodespace.sh index c98469a..6ac5877 100644 --- a/.devcontainer/setupcodespace.sh +++ b/.devcontainer/setupcodespace.sh @@ -25,4 +25,16 @@ then echo "Error: Set envars not set, valid values not passed in. You will have to manually use the valet/.env.local folder" fi + +# if Jenkins codespace secrets are set, spin up Jenkins instance + +if [ -z "$7" -o -z "$8"] ] +then +else + echo "Jenkins secrets are set, starting Jenkins service" + ../jenkins/jenkins_setup/setupjenkins.sh $7 $8 +fi + + + echo "Finished setupcodespace.sh" diff --git a/.devcontainer/setupjenkins.sh b/.devcontainer/setupjenkins.sh deleted file mode 100644 index 85a1b92..0000000 --- a/.devcontainer/setupjenkins.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -container_name="jenkins" -username="admin" -password="password" - -echo "Building Jenkins instance!" - -# Build jenkins image from docker compose file -docker build -t jenkins:$container_name $(pwd)/jenkins/jenkins_setup - -# wait until docker image is ready -sleep 2 - -# Build container -docker run --name jenkins --rm -p 8080:8080 --env JENKINS_ADMIN_ID=$username --env JENKINS_ADMIN_PASSWORD=$password jenkins:$container_name -