Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lab-GitLab-CI-CD
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LSDS
Teaching
Bachelor
Cloud-and-Deployment
Lab-GitLab-CI-CD
Commits
6cdafa58
Commit
6cdafa58
authored
1 year ago
by
marcoemi.poleggi
Browse files
Options
Downloads
Patches
Plain Diff
CI/CD Pipeline: move before_script inside a default block
parent
6f5cca70
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+14
-13
14 additions, 13 deletions
.gitlab-ci.yml
with
14 additions
and
13 deletions
.gitlab-ci.yml
+
14
−
13
View file @
6cdafa58
...
...
@@ -11,19 +11,20 @@ stages:
-
test
-
deploy
# Commmon to all stages -- needed because the image's storage is not persistent across them
before_script
:
# uncomment for debugging. Watch out! It *will* expose any secret passed from an unprotected variable.
# - export
-
apk -U add git openssh-client rsync
-
mkdir -p -m 0700 ~/.ssh
-
touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts
-
'
[[
-f
/.dockerenv
]]
&&
echo
-e
"Host
*\n\tStrictHostKeyChecking
no\n\n"
>>
~/.ssh/config'
-
git config --global user.email "deployer@ci-cd.lab"
-
git config --global user.name "The Deployer"
-
eval $(ssh-agent -s)
-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
-
echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
default
:
# Commmon to all stages -- needed because the image's storage is not persistent across them
before_script
:
# uncomment for debugging. Watch out! It *will* expose any secret passed from an unprotected variable.
# - export
-
apk -U add git openssh-client rsync
-
mkdir -p -m 0700 ~/.ssh
-
touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts
-
'
[[
-f
/.dockerenv
]]
&&
echo
-e
"Host
*\n\tStrictHostKeyChecking
no\n\n"
>>
~/.ssh/config'
-
git config --global user.email "deployer@ci-cd.lab"
-
git config --global user.name "The Deployer"
-
eval $(ssh-agent -s)
-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
-
echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
unit_test1
:
stage
:
test
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment