mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-29 21:57:59 +00:00
In this particular example `mr.HeadPipeline.SHA` panics on a nil pointer dereference because HeadPipeline is empty.
This seems to be caused by the lack of permission to update the commit status.
```go
runtime.gopanic
runtime/panic.go:1038
runtime.panicmem
runtime/panic.go:221
runtime.sigpanic
runtime/signal_unix.go:735
github.com/runatlantis/atlantis/server/events/vcs.(*GitlabClient).PullIsMergeable
github.com/runatlantis/atlantis/server/events/vcs/gitlab_client.go:208
github.com/runatlantis/atlantis/server/events/vcs.(*ClientProxy).PullIsMergeable
github.com/runatlantis/atlantis/server/events/vcs/proxy.go:72
github.com/runatlantis/atlantis/server/events/vcs.(*pullReqStatusFetcher).FetchPullStatus
github.com/runatlantis/atlantis/server/events/vcs/pull_status_fetcher.go:28
github.com/runatlantis/atlantis/server/events.(*ApplyCommandRunner).Run
github.com/runatlantis/atlantis/server/events/apply_command_runner.go:105
github.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand
github.com/runatlantis/atlantis/server/events/command_runner.go:252
```
The least invasive solution is to simply use the commit-hash from pull and guess that the pipeline was "skipped" unless the HeadPipeline is there.
The outcome is:
When mr.HeadPipeline is present:
- use the commit hash and status from the HeadPipeline
When mr.HeadPipeline is NOT present:
- use the commit hash from pull request struct
- assume the pipeline was "skipped"
In cases where GitLab is configured to require a pipeline to pass, this results on a message saying the MR is not mergeable.
More info:
- https://github.com/runatlantis/atlantis/issues/1852
29 lines
940 B
Bash
Executable File
29 lines
940 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Exit immediately if a command returns a non-zero code
|
|
set -e
|
|
|
|
echo "Preparing to run e2e tests"
|
|
if [ ! -f atlantis ]; then
|
|
echo "atlantis binary not found. exiting...."
|
|
exit 1
|
|
fi
|
|
cp atlantis ${CIRCLE_WORKING_DIRECTORY}/e2e/
|
|
|
|
# cd into e2e folder
|
|
cd e2e/
|
|
# Download terraform
|
|
curl -LOk https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
|
|
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip
|
|
chmod +x terraform
|
|
cp terraform /home/circleci/go/bin
|
|
# Download ngrok to create a tunnel to expose atlantis server
|
|
wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v2-stable-linux-amd64.zip -O ngrok-stable-linux-amd64.zip
|
|
unzip ngrok-stable-linux-amd64.zip
|
|
chmod +x ngrok
|
|
# Download jq
|
|
wget -O jq https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64
|
|
chmod +x jq
|
|
# Copy github config file - replace with circleci user later
|
|
cp .gitconfig ~/.gitconfig
|