Skip to content

Instantly share code, notes, and snippets.

View rjpkuyper's full-sized avatar

Robert-Jan Kuyper rjpkuyper

View GitHub Profile
version: "3.8"
services:
dogs:
image: registry.gitlab.com/m6093/server-b/dogs
cats:
image: registry.gitlab.com/m6093/server-c/cats
services:
- name: registry.gitlab.com/m6093/server-c/cats
alias: cats
- name: registry.gitlab.com/m6093/server-b/dogs
alias: dogs
import {
Controller,
Get,
Head,
HttpService
} from "@nestjs/common";
@Controller()
export class PetsController {
constructor(private readonly httpService: HttpService) {}
version: "3.8"
services:
server:
build: ./
command: sh -c "npm run start:debug"
ports:
- 3000:3000
volumes:
- ./src:/home/usr/app/src
environment:
import request from "supertest";
describe("pets (e2e)", () => {
const req = request("http://localhost:3000");
const cats = [{
name: "meow",
age: 1,
breed: "cat",
}];
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .npm/
default:
image: node:16.9.0
variables:
$ npx nest start &
$ npx wait-on --httpTimeout 5000 http://localhost:3000/health
[Nest] 58 - 11/27/2021, 6:38:44 PM [NestFactory] Starting Nest application...
[Nest] 58 - 11/27/2021, 6:38:44 PM [InstanceLoader] HttpModule dependencies initialized +47ms
[Nest] 58 - 11/27/2021, 6:38:44 PM [InstanceLoader] PetsModule dependencies initialized +1ms
[Nest] 58 - 11/27/2021, 6:38:44 PM [RoutesResolver] PetsController {}: +6ms
[Nest] 58 - 11/27/2021, 6:38:44 PM [RouterExplorer] Mapped {/cats, GET} route +3ms
[Nest] 58 - 11/27/2021, 6:38:44 PM [RouterExplorer] Mapped {/dogs, GET} route +1ms
[Nest] 58 - 11/27/2021, 6:38:44 PM [RouterExplorer] Mapped {/health, HEAD} route +1ms
[Nest] 58 - 11/27/2021, 6:38:44 PM [NestApplication] Nest application successfully started +2ms
@rjpkuyper
rjpkuyper / .gitlab-ci.yml
Created August 20, 2022 19:46
A working example of 3 jobs
build:
script:
- echo 'building development'
environment: development
except:
- /^release.*$/
- master
build:acc:
script:
@rjpkuyper
rjpkuyper / .gitlab-ci.yml
Created August 20, 2022 20:05
A better approach
.build:
script:
- echo $ENVIRONMENT
build:
extends: .build
environment: development
variables:
ENVIRONMENT: development
except:
FROM alpine
ARG ENVIRONMENT
ENV ENVIRONMENT ${ENVIRONMENT}
CMD echo ${ENVIRONMENT}