From 638fbb22482e09d661b9f8b8802abed32221b91e Mon Sep 17 00:00:00 2001 From: Suchin Sapphasitthatha Date: Mon, 16 Dec 2024 16:52:23 +0000 Subject: [PATCH 1/2] add CI --- .onedev-buildspec.yml | 102 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .onedev-buildspec.yml diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml new file mode 100644 index 0000000..7087041 --- /dev/null +++ b/.onedev-buildspec.yml @@ -0,0 +1,102 @@ +version: 37 +jobs: +- name: CI for UAT + steps: + - !CheckoutStep + name: checkout code + cloneCredential: !DefaultCredential {} + withLfs: false + withSubmodules: false + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !GenerateChecksumStep + name: generate package checksum + files: package-lock.json yarn.lock + targetFile: checksum + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !SetupCacheStep + name: set up npm cache + key: node_modules_@file:checksum@ + loadKeys: + - node_modules + paths: + - node_modules + uploadStrategy: UPLOAD_IF_NOT_HIT + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !SetBuildVersionStep + name: set build version + buildVersion: '@tag@' + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !CommandStep + name: build & test + runInContainer: true + image: node + interpreter: !DefaultInterpreter + commands: | + npm install + npm run build + useTTY: true + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !BuildImageStep + name: build docker image + dockerfile: ./docker/Dockerfile + output: !RegistryOutput + tags: hrms-git.chin.in.th/bma-hrms/hrms-api-sso:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-sso:latest + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + triggers: + - !TagCreateTrigger + tags: uat-* + branches: main + retryCondition: never + maxRetries: 3 + retryDelay: 30 + timeout: 14400 +- name: CI for PROD + steps: + - !CheckoutStep + name: checkout code + cloneCredential: !DefaultCredential {} + withLfs: false + withSubmodules: false + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !GenerateChecksumStep + name: generate package checksum + files: package-lock.json yarn.lock + targetFile: checksum + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !SetupCacheStep + name: set up npm cache + key: node_modules_@file:checksum@ + loadKeys: + - node_modules + paths: + - node_modules + uploadStrategy: UPLOAD_IF_NOT_HIT + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !SetBuildVersionStep + name: set build version + buildVersion: '@tag@' + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !CommandStep + name: build & test + runInContainer: true + image: node + interpreter: !DefaultInterpreter + commands: | + npm install + npm run build + useTTY: true + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !BuildImageStep + name: build docker image + dockerfile: ./docker/Dockerfile + output: !RegistryOutput + tags: hrms-git.bangkok.go.th/bma-hrms/hrms-api-sso:@build_version@ hrms-git.bangkok.go.th/bma-hrms/hrms-api-sso:latest + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + triggers: + - !TagCreateTrigger + tags: prod-* + branches: main + retryCondition: never + maxRetries: 3 + retryDelay: 30 + timeout: 14400 From a3da32fa524fb05e9c00c79ecf445e0484a03335 Mon Sep 17 00:00:00 2001 From: Suchin Sapphasitthatha Date: Mon, 16 Dec 2024 16:57:55 +0000 Subject: [PATCH 2/2] fix CI --- .onedev-buildspec.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml index 7087041..e7ffd42 100644 --- a/.onedev-buildspec.yml +++ b/.onedev-buildspec.yml @@ -33,7 +33,6 @@ jobs: interpreter: !DefaultInterpreter commands: | npm install - npm run build useTTY: true condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL - !BuildImageStep @@ -83,7 +82,6 @@ jobs: interpreter: !DefaultInterpreter commands: | npm install - npm run build useTTY: true condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL - !BuildImageStep