I am having difficulty with my pipeline I'm trying to configured, based off of this document - link
I am trying to integrate the example pipeline code into my current one, I have got this far:
default:
image:
name: hashicorp/terraform:light
entrypoint:
- /usr/bin/env
- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
stages:
- validate
- yor
validate:
stage: validate
before_script:
- rm -rf .terraform
- terraform --version
- terraform init
- export AWS_DEFAULT_REGION=eu-west-1
script:
- terraform validate -json
only:
- merge_requests
run-yor:
stage: yor
image: ruby:2.5
script:
- git checkout ${CI_COMMIT_SHA}
- export YOR_VERSION=0.1.62
- wget -q -O - https://github.com/bridgecrewio/yor/releases/download/${YOR_VERSION}/yor-${YOR_VERSION}-linux-amd64.tar.gz | tar -xvz -C /tmp
- /tmp/yor tag -d .
after_script:
- |
cd $CI_PROJECT_DIR
git status
lines=$(git status -s | wc -l)
if [ $lines -gt 0 ];then
echo "committing"
git config --global user.name "$AUTO_COMMITTER_NAME"
git config --global user.email "$AUTO_COMMITTER_EMAIL"
echo ".yor_plugins" >> .gitignore
git add .
git commit -m "YOR: Auto add/update yor.io tags."
git push -o ci.skip "https://${GITLAB_USER_NAME}:${GIT_PUSH_TOKEN}@${CI_REPOSITORY_URL#*@}"
else
echo "no updated resources, nothing to commit."
fi
only:
- merge_requests
However, when running I receive this error in the output:
Running after_script
00:01
Running after script...
$ cd $CI_PROJECT_DIR # collapsed multi-line command
HEAD detached at c839d93
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: cloudformation.tf
no changes added to commit (use "git add" and/or "git commit -a")
committing
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <>) not allowed
It seems like it is not parsing the multi line script correctly and I cannot figure out how exactly to get this working. I also see in the original script on the linked page, the script is called differently, I'll be honest I don't fully understand how they are calling the script.
Any help would be great.
after_script
? – Thymol