Gergely Csatari | 9205c55 | 2021-09-08 11:53:02 +0300 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright 2021 Nokia |
| 4 | # Licensed under the Apache License 2.0 |
| 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | |
| 7 | set -x |
| 8 | echo "run-c2m -------------------------------------------------------------" |
| 9 | if [[ -z "$CONFLUENCE_USERNAME" || -z "$CONFLUENCE_PASSWORD" ]] |
| 10 | then |
| 11 | echo "Mandatory environment variables:" |
| 12 | echo " CONFLUENCE_USERNAME: Confluence username" |
| 13 | echo " CONFLUENCE_PASSWORD: Confluence password." |
| 14 | echo "Be aware! Setting bash debuging on will print credentials." |
| 15 | exit |
| 16 | fi |
| 17 | |
| 18 | proxy="" |
| 19 | if [[ -z "${http_proxy}" ]]; then |
| 20 | echo "http_proxy is empty" |
| 21 | else |
| 22 | echo "http_proxy is set to $http_proxy" |
| 23 | if [[ $http_proxy =~ ^http:\/\/[0-9] ]]; then |
| 24 | echo "starts with http" |
| 25 | proxy=$http_proxy |
| 26 | elif [[ $http_proxy =~ ^[0-9] ]]; then |
| 27 | echo "starts with number" |
| 28 | proxy=http://$http_proxy |
| 29 | fi |
| 30 | fi |
| 31 | |
| 32 | echo "Proxy set to $proxy, build env is $build_env." |
| 33 | |
| 34 | docker run -e http_proxy=$proxy -e https_proxy=$proxy -e HTTP_PROXY=$proxy -e HTTPS_PROXY=$proxy -e CONFLUENCE_PASSWORD=$CONFLUENCE_PASSWORD -e CONFLUENCE_USERNAME=$CONFLUENCE_USERNAME -v $PWD:/mount c2m:latest ./c2m-wrapper.sh /mount/$1 |