This commit is contained in:
ls
2024-10-11 20:39:43 +08:00
parent 1d4b46b9fb
commit f91ade7f60
2 changed files with 4 additions and 14 deletions

View File

@@ -18,32 +18,22 @@
stages: # List of stages for jobs, and their order of execution stages: # List of stages for jobs, and their order of execution
- build - build
- test
- deploy - deploy
build-job: # This job runs in the build stage, which runs first. build-job: # This job runs in the build stage, which runs first.
stage: build stage: build
script: script:
- echo "Compiling the code..." - echo "Compiling the code..."
- mvn -s ./settings.xml -DskipTests=true clean install
- echo "Compile complete." - echo "Compile complete."
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage. deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully. stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
environment: production environment: production
script: script:
- echo "Deploying application..." - echo "Deploying application..."
- docker login --username=lslvxy@163.com -password-stdin < /root/docker_password registry.cn-shanghai.aliyuncs.com
- docker build --platform linux/amd64 -t registry.cn-shanghai.aliyuncs.com/physical/physical-boot --push .
- echo "Application successfully deployed." - echo "Application successfully deployed."

View File

@@ -1,5 +1,5 @@
#FROM bellsoft/liberica-openjdk-debian:17 #FROM bellsoft/liberica-openjdk-debian:17
FROM maven:3.9.8-eclipse-temurin-17 as build FROM maven:3.9.8-eclipse-temurin-17 AS build
WORKDIR /app WORKDIR /app