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

Commit

Permalink
Merge pull request #216 from lucified/git-http-authentication
Browse files Browse the repository at this point in the history
Git http authentication
  • Loading branch information
juhoojala authored Jun 20, 2017
2 parents 681c71f + 49b20cc commit 5b827da
Show file tree
Hide file tree
Showing 73 changed files with 5,024 additions and 4,564 deletions.
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

0 comments on commit 5b827da

Please sign in to comment.