Skip to content
This repository has been archived by the owner on Sep 30, 2019. It is now read-only.

Git http authentication #216

Merged
merged 44 commits into from
Jun 20, 2017
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d367d18
Add a proxy and authentication scheme for git http connections
dennari Jun 7, 2017
db262bd
Update existing integration tests and add new ones for git http authe…
dennari Jun 7, 2017
06079e1
Generate deterministic GitLab passwords
dennari Jun 7, 2017
0953088
Regenerate GitLab passwords
dennari Jun 7, 2017
b93fc5b
Cleanup and formatting
dennari Jun 8, 2017
dfe498e
Clean up code
vsaarinen Jun 9, 2017
66973e6
Add Auth0 dependency
vsaarinen Jun 9, 2017
2bf0cae
Avoid using `import * as`
vsaarinen Jun 9, 2017
9c6cb5f
Don't import Boom as *
vsaarinen Jun 9, 2017
539e248
Fix util-promisify
vsaarinen Jun 9, 2017
b91047f
Add comments
dennari Jun 12, 2017
9b2a5ec
Fix calls to fetchJson
dennari Jun 12, 2017
d3f9da9
Merge branch 'git-http-authentication' into avoid-importing-all
dennari Jun 12, 2017
aec584d
Fix getUsers in gitlab-client
juhoojala Jun 15, 2017
b14c98b
Don’t change password for root user
juhoojala Jun 15, 2017
3a8f876
Fix some documentation
juhoojala Jun 15, 2017
0a1f6d6
Sligthly cleanup git-authentication-tests
juhoojala Jun 15, 2017
1491565
Improve comments in config-production
juhoojala Jun 15, 2017
a999a0f
Merge pull request #217 from lucified/avoid-importing-all
juhoojala Jun 15, 2017
030a82e
Have a single admin user instead of an admin team
dennari Jun 9, 2017
005ea58
Add the 'charles-client' cli
dennari Jun 9, 2017
0925a2a
Fix the tests
dennari Jun 9, 2017
b6ec778
Improve documentation
juhoojala Jun 15, 2017
0a50582
Merge pull request #218 from lucified/admin-access
juhoojala Jun 15, 2017
5ea30bf
Upgraded Hapi's typings
dennari Jun 12, 2017
7cb2646
Avoid binding stubbed methods in constructor
dennari Jun 13, 2017
f13fe1d
Remove weird character
juhoojala Jun 15, 2017
35a0f05
Merge pull request #219 from lucified/upgrade-typings-hapi
juhoojala Jun 15, 2017
7aa2a7f
Remove git password related code from AuthenticationHapiPlugin
dennari Jun 16, 2017
90f6ffe
Throw errors in intra-team tests but not in the inter-team ones
dennari Jun 16, 2017
36caae8
Use node 8.1
dennari Jun 16, 2017
e2ef9ec
Update docs
dennari Jun 16, 2017
9955de7
Minor package updates
dennari Jun 16, 2017
46acc2e
Also update the production Dockerfile to Node 8
dennari Jun 16, 2017
b9ed9e0
Include package-lock.json
dennari Jun 16, 2017
b56fb3a
Don't clone the headers in mapUri
dennari Jun 19, 2017
d047286
Prevent writing to package-lock.json on npm install
dennari Jun 19, 2017
8c2c79f
Don't use package-lock.json
dennari Jun 19, 2017
6f352e1
Just use Yarn
dennari Jun 19, 2017
755edcb
Fix typing errors
dennari Jun 19, 2017
4af2fba
Use the included Yarn
dennari Jun 19, 2017
e1bf5d6
Don't transpile in the production container
dennari Jun 19, 2017
dfb207e
Fix typo and increase timeout
dennari Jun 19, 2017
49b20cc
Minor casting tweaks
vsaarinen Jun 20, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ temp
tmp
gitlab-data
.vscode
dist
24 changes: 6 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
FROM node:8-alpine
FROM node:8.1-alpine

WORKDIR /code

RUN npm --version
RUN ulimit -n

# https://github.com/npm/npm/issues/7862
# https://github.com/npm/npm/issues/8836
RUN npm config set maxsockets 5
RUN npm config set registry http://registry.npmjs.org/
RUN npm config set strict-ssl false

RUN npm install -g node-dev node-gyp
RUN yarn global add node-dev node-gyp

COPY package.json /code/package.json
COPY package-lock.json /code/package-lock.json
RUN npm install
COPY yarn.lock /code/yarn.lock
RUN yarn

COPY . /code
RUN npm run transpile

# https://github.com/npm/npm/issues/4531
RUN npm config set unsafe-perm true
RUN yarn run transpile

CMD ["npm", "start"]
CMD ["yarn", "start"]
12 changes: 5 additions & 7 deletions Dockerfile-production
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
FROM node:7.5-alpine

FROM node:8.1-alpine
RUN echo #### Remember to transpile before building! ####
WORKDIR /code

COPY package.json /code/package.json

RUN npm install

COPY yarn.lock /code/yarn.lock
ENV NODE_ENV production
RUN yarn install --prod

# NOTE: 'dist/' is assumed to contains the latest transpiled code
COPY . /code
RUN npm run transpile
RUN npm prune && rm -rf src

# NOTE: don't use npm here since the OS signals, e.g. SIGTERM, won't propagate
# (read https://github.com/yelp/dumb-init for more)
Expand Down
18 changes: 12 additions & 6 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@ machine:
environment:
COMMIT: $CIRCLE_SHA1

dependencies:
pre:
- npm install -g yarn
override:
- yarn

test:
override:
- npm run clean-test
- npm run lint
- yarn run clean-test
- yarn run lint

deployment:
auto:
branch: master
commands:
- npm run write-version
- npm run deploy
- yarn run write-version
- yarn run deploy
chatops:
branch: /^(?!nodeploy-).*$/
commands:
- npm run write-version
- npm run deploy-chatops
- yarn run write-version
- yarn run deploy-chatops
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ services:
- SCREENSHOT_URL_PATTERN=http://minard-%s.deployment.charles.internal:8000
- SCREENSHOTTER_BASEURL=http://screenshotter
- DEPLOYMENT_URL_PATTERN=http://%s.deployment.localtest.me:8000
- EXTERNAL_GIT_BASEURL=http://localhost:10080
- EXTERNAL_GIT_BASEURL=http://git.localtest.me:8000
- GITLAB_ROOT_PASSWORD=12345678
- SENTRY_DSN=$SENTRY_DSN
- ADMIN_TEAM_NAME=integrationtestadminteam
- ADMIN_ID=9A0cjUjLPIAIP52xTTWvuakblphA8EYu
- OPEN_TEAM_NAMES=integrationtestopenteam
- EXIT_DELAY=0
- DEBUG=1
42 changes: 0 additions & 42 deletions docs/testing-legacy.md

This file was deleted.

40 changes: 30 additions & 10 deletions docs/testing.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# Prerequisites
# Tests

## Unit tests

The backend has more than 250 unit tests. Run them with
```shell
npm test
```

All unit tests are named with the pattern `foo-spec.ts`. The test
files are located in the same directory as the code to be tested.

## System integration tests

### Prerequisites

The integration tests require a configuration file, `src/integration-test/configuration.{environment}.ts` for each environment
you want to run the tests against. The
Expand All @@ -24,9 +38,9 @@ interface Config {
},
};
auth0: {
regular: Auth0 & { gitPassword: string };
open: Auth0 & { gitPassword: string };
admin: Auth0 & { gitPassword: string };
regular: Auth0;
open: Auth0;
admin: Auth0;
};
}
interface Auth0 {
Expand All @@ -42,7 +56,7 @@ An example file can be found from `src/integration-test/configuration.example.ts
The integration tests assume that a predefined set of "users" have been created in Auth0 and linked with
corresponding user accounts and groups in GitLab. To be able to get up and running from scratch remains a TODO.

## Auth0 configuration
### Auth0 configuration

We currenty have three kinds of teams: *regular*, *open* and *admin*.
A new non interactive client needs to be created for each of these.
Expand All @@ -56,19 +70,25 @@ to the integration test configuration file described above.

## GitLab configuration

Create three new groups, 'integration-test', 'integration-test-open' and 'integration-test-admin'.
Create two new groups, 'integrationtest' and 'integrationtestopenteam'.
Add a user to each of these and set the username to `clients-{clientId}` where clientId
is the id of the corresponding Auth0 client. Set the user's password to some generated value and
copy it to the `gitPassword` field of the corresponding team in the `auth0` block
of the configuration file.
is the id of the corresponding Auth0 client. Additionally, create one more user, which
you don't need to add to any group. This will be the admin user.

After creating the groups and users, update the passwords for all users
by running:

```shell
charles-client regenerateGitlabPasswords
```

## Charles's configuration

Make sure the following environment variables have been set when starting charles:

```shell
ADMIN_ID=auth0ClientIdForAdminUser
OPEN_TEAM_NAMES=integrationtestopenteam
ADMIN_TEAM_NAME=integrationtestadminteam
```

# Running the tests
Expand Down
Loading