Rename stages and jobs to be more sane

This commit is contained in:
Daniel_I_Am 2020-10-28 20:29:41 +01:00
parent 6e63393b3d
commit 437ec8d117
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84

View File

@ -10,12 +10,12 @@ variables:
NODE_MODULES_DIRECTORY: 'wwwroot/node_modules' NODE_MODULES_DIRECTORY: 'wwwroot/node_modules'
stages: stages:
- version - "Build Code"
- build - "Test Code"
- test - "Compile Release"
- release - "Get Next Version"
- docker - "Build Docker Image"
- deploy - "Pull Image on Production"
cache: cache:
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG" key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
@ -34,8 +34,88 @@ cache:
# #
policy: pull-push policy: pull-push
version: "Build dotnet":
stage: version stage: "Build Code"
only:
changes:
- ChaosBot/**/*
tags:
- docker
- hawkeye
script:
- 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY'
- 'dotnet build --no-restore'
"Test dotnet":
stage: "Test Code"
only:
changes:
- ChaosBot/**/*
refs:
- master
dependencies:
- "Build dotnet"
tags:
- docker
- hawkeye
script:
- 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY'
- 'dotnet test --no-restore'
"Build node":
image: node:latest
stage: "Build Code"
only:
changes:
- ChaosBot/wwwroot/*
tags:
- docker
- hawkeye
script:
- 'cd ChaosBot/wwwroot'
- 'yarn install'
- 'yarn build'
artifacts:
paths:
- ChaosBot/wwwroot/dist/*
"Test node":
image: node:latest
stage: "Test Code"
only:
changes:
- ChaosBot/wwwroot/*
dependencies:
- "Build node"
tags:
- docker
- hawkeye
script:
- 'cd ChaosBot/wwwroot'
- 'yarn install'
- 'yarn lint'
"Compile release":
stage: "Compile Release"
only:
changes:
- ChaosBot/**/*
dependencies:
- "Test dotnet"
- "Build node"
- "Test node"
tags:
- docker
- hawkeye
script:
- 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY'
- 'dotnet publish -c Release --runtime linux-musl-x64 -o build -p:PublishSingleFile=true ChaosBot'
artifacts:
paths:
- build/*
"Get next version":
stage: "Get Next Version"
only: only:
changes: changes:
- ChaosBot/**/* - ChaosBot/**/*
@ -59,101 +139,9 @@ version:
paths: paths:
- version - version
build_dotnet: "Build docker image":
stage: build
only:
changes:
- ChaosBot/**/*
refs:
- master
dependencies:
- version
tags:
- docker
- hawkeye
script:
- 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY'
- 'dotnet build --no-restore'
tests_dotnet:
stage: test
only:
changes:
- ChaosBot/**/*
refs:
- master
dependencies:
- build_dotnet
tags:
- docker
- hawkeye
script:
- 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY'
- 'dotnet test --no-restore'
build_node:
image: node:latest
stage: build
only:
changes:
- ChaosBot/**/*
refs:
- master
dependencies:
- version
tags:
- docker
- hawkeye
script:
- 'cd ChaosBot/wwwroot'
- 'yarn install'
- 'yarn build'
artifacts:
paths:
- ChaosBot/wwwroot/dist/*
tests_node:
image: node:latest
stage: test
only:
changes:
- ChaosBot/**/*
refs:
- master
dependencies:
- build_node
tags:
- docker
- hawkeye
script:
- 'cd ChaosBot/wwwroot'
- 'yarn install'
- 'yarn lint'
release:
stage: release
only:
changes:
- ChaosBot/**/*
refs:
- master
dependencies:
- tests_dotnet
- tests_node
- build_node
tags:
- docker
- hawkeye
script:
- 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY'
- 'dotnet publish -c Release --runtime linux-musl-x64 -o build -p:PublishSingleFile=true ChaosBot'
artifacts:
paths:
- build/*
docker:
image: docker:stable image: docker:stable
stage: docker stage: "Build Docker Image"
only: only:
changes: changes:
- ChaosBot/**/* - ChaosBot/**/*
@ -163,8 +151,8 @@ docker:
- docker - docker
- hawkeye - hawkeye
dependencies: dependencies:
- version - "Get next version"
- release - "Compile release"
script: script:
# Log in to the registry # Log in to the registry
- 'docker login -u=$REGISTRY_USER -p=$REGISTRY_PASS registry.chaoticlogic.us' - 'docker login -u=$REGISTRY_USER -p=$REGISTRY_PASS registry.chaoticlogic.us'
@ -178,8 +166,8 @@ docker:
- 'docker -H unix:///var/run/docker.sock image push registry.chaoticlogic.us/chaosbot:latest' - 'docker -H unix:///var/run/docker.sock image push registry.chaoticlogic.us/chaosbot:latest'
deploy: "Pull image on production":
stage: deploy stage: "Pull Image on Production"
only: only:
changes: changes:
- ChaosBot/**/* - ChaosBot/**/*
@ -189,7 +177,7 @@ deploy:
- docker - docker
- hawkeye - hawkeye
dependencies: dependencies:
- docker - "Build docker image"
script: script:
- 'apk add curl jq' - 'apk add curl jq'
# Sign in with credentials # Sign in with credentials