-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
66 lines (61 loc) · 1.96 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
66 lines (61 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
stages:
- build
- sonarqube-check
- docker-push
variables:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
PROJECT_PATH: "Sources/Shizima.WebAPI"
IMAGE_NAME: "axdelafuen/shizima_webapi"
IMAGE_TAG: "latest"
CI_REGISTRY: "docker.isima.fr"
NUGET_FEED_URL: "https://gitlab.isima.fr/api/v4/groups/11770/-/packages/nuget/index.json"
NUGET_FEED_NAME: "gitlab.isima"
before_script:
- dotnet --version
- dotnet nuget locals all --clear
- dotnet nuget add source $NUGET_FEED_URL --name $NUGET_FEED_NAME --username gitlab+deploy-token-38 --password $NUGET_PASSWORD_2 --store-password-in-clear-text
build:
image: mcr.microsoft.com/dotnet/sdk:8.0
stage: build
script:
- dotnet restore $PROJECT_PATH
- dotnet build $PROJECT_PATH --no-restore
sonarqube-check:
image: mcr.microsoft.com/dotnet/sdk:8.0
stage: sonarqube-check
dependencies:
- build
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
GIT_DEPTH: "0"
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- "cd ./Sources/"
- "rm -rf /var/lib/apt/lists/*"
- "apt-get clean"
- "apt-get update"
- "apt-get install --yes default-jre"
- "dotnet tool install --global dotnet-sonarscanner"
- "export PATH=\"$PATH:$HOME/.dotnet/tools\""
- "dotnet sonarscanner begin /k:\"shizima.webapi\" /d:sonar.login=\"$SONAR_TOKEN\" /d:\"sonar.host.url=$SONAR_HOST_URL\" "
- "dotnet build"
- "dotnet sonarscanner end /d:sonar.login=\"$SONAR_TOKEN\""
allow_failure: true
only:
- master
docker-push:
before_script: []
image: docker:latest
stage: docker-push
services:
- docker:dind
script:
- echo "$DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $DOCKER_USERNAME --password-stdin
- docker build -f $PROJECT_PATH/Dockerfile -t $CI_REGISTRY/$IMAGE_NAME:$IMAGE_TAG --build-arg NUGET_PASSWORD_2=$NUGET_PASSWORD_2 ./Sources
- docker push $CI_REGISTRY/$IMAGE_NAME:$IMAGE_TAG
only:
- master