Commit 7b23c6f0 authored by Nick Thomas's avatar Nick Thomas

Merge branch '194-add-makefile-to-make-things-easier' into 'master'

Add Makefile for easier building and testing

Closes #194

See merge request gitlab-org/gitlab-shell!310
parents e896becc fdfc4ab0
......@@ -15,8 +15,7 @@ before_script:
# primarily regression tests for particular versions of Ruby.
#
# The full rspec suite is also run against each suppported golang version
- cp bin/gitlab-shell-ruby bin/gitlab-shell
- bundle exec rspec --color --tag ~go --format d spec
- make test_ruby
rspec:
<<: *rspec_definition
......@@ -25,9 +24,9 @@ rspec:
except:
- tags
rubocop:
verify_ruby:
script:
- bundle exec rubocop
- make verify_ruby
tags:
- ruby
except:
......@@ -77,13 +76,11 @@ rspec:ruby2.1:
script:
- go version
- which go
- bin/compile
- support/go-test
- support/go-format check
- make build verify_golang test_golang
# Run the full Ruby test suite in the "go" tests. As more functionality is
# migrated into these tests and out of Ruby, the amount of work here will
# reduce
- bundle exec rspec --color --format d spec
- make test_ruby
go:1.11:
<<: *go_definition
......@@ -111,7 +108,6 @@ codequality:
artifacts:
paths: [codeclimate.json]
sast:
image: docker:stable
variables:
......
.PHONY: test test_ruby test_ruby_rubocop test_ruby_rspec test_go test_go_format test_go_test
validate: verify test
verify: verify_ruby verify_golang
verify_ruby:
bundle exec rubocop
verify_golang:
support/go-format check
test: test_ruby test_golang
test_ruby:
# bin/gitlab-shell must exist and needs to be the Ruby version for
# rspec to be able to test.
cp bin/gitlab-shell-ruby bin/gitlab-shell
bundle exec rspec --color --tag '~go' --format d spec
rm -f bin/gitlab-shell
test_golang:
support/go-test
setup: compile
build: compile
compile:
bin/install
bin/compile
check:
bin/check
clean:
rm -f bin/gitlab-shell
......@@ -15,15 +15,15 @@ If you access a GitLab server over HTTP(S) you end up in [gitlab-workhorse](http
An overview of the four cases described above:
1. git pull over ssh -> gitlab-shell -> API call to gitlab-rails (Authorization) -> accept or decline -> establish Gitaly session
1. git push over ssh -> gitlab-shell (git command is not executed yet) -> establish Gitaly session -> (in Gitaly) gitlab-shell pre-receive hook -> API call to gitlab-rails (authorization) -> accept or decline push
1. git pull over SSH -> gitlab-shell -> API call to gitlab-rails (Authorization) -> accept or decline -> establish Gitaly session
1. git push over SSH -> gitlab-shell (git command is not executed yet) -> establish Gitaly session -> (in Gitaly) gitlab-shell pre-receive hook -> API call to gitlab-rails (authorization) -> accept or decline push
## Git hooks
The gitlab-shell repository used to also contain the
Git hooks that allow GitLab to validate Git pushes (e.g. "is this user
allowed to push to this protected branch"). These hooks also trigger
events in GitLab (e.g. to start a CI pipeline after a push).
events in GitLab (e.g. to start a CI pipeline after a push).
We are in the process of moving these hooks to Gitaly, because Git hooks
require direct disk access to Git repositories, and that is only
......@@ -68,12 +68,13 @@ To install gitlab-shell you also need a Go compiler version 1.8 or newer. https:
## Setup
./bin/install
./bin/compile
make setup
## Check
./bin/check
Checks if GitLab API access and redis via internal API can be reached:
make check
## Keys
......@@ -89,14 +90,27 @@ List all keys:
./bin/gitlab-keys list-keys
Remove all keys from authorized_keys file:
./bin/gitlab-keys clear
## Testing
Run Ruby and Golang tests:
make test
Run Rubocop and gofmt:
make verify
Run both test and verify (the default Makefile target):
make validate
## Git LFS remark
Starting with GitLab 8.12, GitLab supports Git LFS authentication through ssh.
Starting with GitLab 8.12, GitLab supports Git LFS authentication through SSH.
## Migration to Go feature flags
......@@ -158,14 +172,14 @@ Rails application:
## Updating VCR fixtures
In order to generate new VCR fixtures you need to have a local GitLab instance
running and have next data:
In order to generate new VCR fixtures you need to have a local GitLab instance
running and have next data:
1. gitlab-org/gitlab-test project.
2. SSH key with access to the project and ID 1 that belongs to Administrator.
3. SSH key without access to the project and ID 2.
You also need to modify `secret` variable at `spec/gitlab_net_spec.rb` so tests
You also need to modify `secret` variable at `spec/gitlab_net_spec.rb` so tests
can connect to your local instance.
## Contributing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment