Skip to content
Snippets Groups Projects
Commit 73293672 authored by jurgenhaas's avatar jurgenhaas
Browse files

Execute authentication preparation script lines only if executables exist

parent acd93880
Branches
No related tags found
No related merge requests found
.prepareaccess:
before_script:
- if [[ -n $SSH_PRIVATE_KEY ]]; then eval $(ssh-agent -s); fi
- if [[ -n $SSH_PRIVATE_KEY ]]; then echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null; fi
- if [[ -n $SSH_PRIVATE_KEY ]]; then mkdir -p ~/.ssh; fi
- if [[ -n $SSH_PRIVATE_KEY ]]; then chmod 700 ~/.ssh; fi
- if [[ -n $SSH_PRIVATE_KEY ]]; then ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts; fi
- if [[ -n $SSH_PRIVATE_KEY ]]; then chmod 644 ~/.ssh/known_hosts; fi
- if [[ -n $SSH_PRIVATE_KEY ]]; then ssh git@${CI_SERVER_HOST}; fi
- if [[ -n $GITLAB_ACCESS_TOKEN ]]; then glab auth login --hostname ${CI_SERVER_HOST} --token $GITLAB_ACCESS_TOKEN; fi
- if [[ -n $GITLAB_PRIVATE_TOKEN ]]; then glab auth login --hostname ${CI_SERVER_HOST} --token $GITLAB_PRIVATE_TOKEN; fi
- if [[ command -v ssh-agent ]] && [[ -n $SSH_PRIVATE_KEY ]]; then eval $(ssh-agent -s); fi
- if [[ command -v ssh-add ]] && [[ -n $SSH_PRIVATE_KEY ]]; then echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null; fi
- if [[ command -v ssh-add ]] && [[ -n $SSH_PRIVATE_KEY ]]; then mkdir -p ~/.ssh; fi
- if [[ command -v ssh-add ]] && [[ -n $SSH_PRIVATE_KEY ]]; then chmod 700 ~/.ssh; fi
- if [[ command -v ssh-keyscan ]] && [[ -n $SSH_PRIVATE_KEY ]]; then ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts; fi
- if [[ command -v ssh-keyscan ]] && [[ -n $SSH_PRIVATE_KEY ]]; then chmod 644 ~/.ssh/known_hosts; fi
- if [[ command -v ssh ]] && [[ -n $SSH_PRIVATE_KEY ]]; then ssh git@${CI_SERVER_HOST}; fi
- if [[ command -v glab ]] && [[ -n $GITLAB_ACCESS_TOKEN ]]; then glab auth login --hostname ${CI_SERVER_HOST} --token $GITLAB_ACCESS_TOKEN; fi
- if [[ command -v glab ]] && [[ -n $GITLAB_PRIVATE_TOKEN ]]; then glab auth login --hostname ${CI_SERVER_HOST} --token $GITLAB_PRIVATE_TOKEN; fi
- if [[ -n $GITLAB_ACCESS_TOKEN ]]; then composer config -g --no-plugins --no-interaction gitlab-token.${CI_SERVER_HOST} $GITLAB_ACCESS_TOKEN; fi
- if [[ -n $GITLAB_PRIVATE_TOKEN ]]; then composer config -g --no-plugins --no-interaction gitlab-token.${CI_SERVER_HOST} $GITLAB_PRIVATE_TOKEN; fi
- if [[ -n $DOCKER_AUTH_CONFIG ]]; then mkdir -p ~/.docker; echo $DOCKER_AUTH_CONFIG > ~/.docker/config.json; fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment