Commit 34b6c0e9 authored by atj's avatar atj
Browse files

Fix environment variables which aren't passed through sudo invocation

parent 51c87231
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
#!/bin/bash

# This script is run as root and so builder user environment variables aren't passed through
source /home/builder/registry-credentials

# Test for any arguments, such as --debug
for i in "$@"
do
+0 −1
Original line number Diff line number Diff line
@@ -101,7 +101,6 @@ After=network.target
Type=simple
User=builder
WorkingDirectory=/home/builder
EnvironmentFile=/home/builder/registry-credentials
Environment="LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib"
ExecStart=/usr/local/bin/builder-server
Restart=no
+5 −2
Original line number Diff line number Diff line
#!/bin/bash

# This script is run as root and so builder user environment variables aren't passed through
source /home/builder/registry-credentials

# Test for any arguments, such as --debug
for i in "$@"
do
@@ -19,7 +22,7 @@ done
grep 'From: code.ornl.gov:4567' ./container.def
GREP_RC=$?
if [[ ${GREP_RC} -eq 0 ]] ; then
    echo "Using container recipes docker registry login credentials"
    echo "Using OLCF Gitlab registry login credentials"
    export SINGULARITY_DOCKER_USERNAME=${GITLAB_READONLY_USERNAME}
    export SINGULARITY_DOCKER_PASSWORD=${GITLAB_READONLY_TOKEN}
fi
@@ -27,7 +30,7 @@ fi
# provide read only access to the private olcf dockerhub repository
grep 'From: olcf/' ./container.def
GREP_RC=$?
if [[ $GREP_RC -eq 0 ]] ; then
if [[ ${GREP_RC} -eq 0 ]] ; then
    echo "Using OLCF Dockerhub registry login credentials"
    export SINGULARITY_DOCKER_USERNAME=${DOCKERHUB_READONLY_USERNAME}
    export SINGULARITY_DOCKER_PASSWORD=${DOCKERHUB_READONLY_TOKEN}