自动打包修改
continuous-integration/drone/push Build is passing Details

Uat_Study
hang 2024-01-03 09:29:07 +08:00
parent be5c9b636e
commit a536c33302
1 changed files with 105 additions and 71 deletions

View File

@ -2,105 +2,139 @@ kind: pipeline
type: docker type: docker
name: irc-netcore-api name: irc-netcore-api
steps: clone:
- name: docker-build disable: true #禁用默认克隆
image: docker
pull: if-not-exists steps:
volumes: - name: clone-repo
- name: dockersock image: alpine/git
path: /var/run/docker.sock pull: if-not-exists
- name: cached_nuget_packages volumes:
path: /drone/nuget_packages - name: irc-test-work
commands: path: /work
- date +%H:%M:%S commands:
- pwd - if [ ! -e /work/netcore-repo/.git ]; then
- docker build -t Test_Study . git clone -b Test.IRC http://192.168.3.68:2000/XCKJ/irc-netcore-api.git /work/netcore-repo;
- date +%H:%M:%S else
cd /work/netcore-repo;
git pull;
fi
- |
if [ ! -e Dockerfile ]; then
echo 'FROM mcr.microsoft.com/dotnet/aspnet:6.0
EXPOSE 80
WORKDIR /app
COPY publish .
ENTRYPOINT ["dotnet", "IRaCIS.Core.API.dll"]' > /work/Dockerfile
fi
- name: restore-publish
image: mcr.microsoft.com/dotnet/sdk:6.0
pull: if-not-exists
depends_on:
- clone-repo
volumes:
- name: nuget-packages
path: /root/.nuget/packages
- name: irc-test-work
path: /work
commands:
- cd /work/netcore-repo/IRaCIS.Core.API
- dotnet restore ./IRaCIS.Core.API.csproj
- rm -rf /work/publish
- cd /work/netcore-repo/IRaCIS.Core.API
- dotnet publish ./IRaCIS.Core.API.csproj -c Release --no-restore -o /work/publish
- name: docker-build
image: docker
pull: if-not-exists
depends_on:
- restore-publish
commands:
- cd /work
- docker build -t test-irc:v${DRONE_BUILD_NUMBER} .
volumes:
- name: irc-test-work
path: /work
- name: dockersock
path: /var/run/docker.sock
- name: docker-deploy
image: docker
pull: if-not-exists
depends_on:
- docker-build
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- date +%H:%M:%S
- docker rm -f test-study-container
- docker run -itd -e TZ=Asia/Shanghai -e ASPNETCORE_ENVIRONMENT=Test_Study --restart=always --name test-study-container -p 8030:80 Test_Study
- date +%H:%M:%S
volumes: volumes:
- name: cached_nuget_packages - name: nuget-packages
host: host:
path: /mnt/d/docker_publish/nuget_packages path: /opt/cicd/nuget/packages
- name: irc-test-work
host:
path: /opt/cicd/irc-test
- name: dockersock - name: dockersock
host: host:
path: /var/run/docker.sock path: /var/run/docker.sock
trigger: trigger:
branch: branch:
- master - master
---
kind: pipeline
type: ssh
name: ssh-linux-test-irc-publish
platform:
os: Linux
arch: 386
clone:
disable: true #禁用默认克隆
server:
host: 123.56.94.154
user: root
password:
from_secret: test_ssh_pwd
steps:
- name: publish-test-irc
commands:
- echo start publish test-irc-api
- cd /opt/1panel/hang/devops/test-irc
- sh test-irc.sh v${DRONE_BUILD_NUMBER}
trigger:
branch:
- Test.IRC
--- ---
kind: pipeline kind: pipeline
type: ssh type: ssh
name: ssh-windows-test-study-publish name: ssh-linux-test-study-publish
platform: platform:
os: windows os: Linux
arch: amd64 arch: 386
clone: clone:
disable: true #禁用默认克隆 disable: true #禁用默认克隆
server: server:
host: 123.56.94.154 host: 123.56.94.154
user: Administrator user: root
password: WHxckj2019 password:
from_secret: test_ssh_pwd
steps: steps:
- name: publish-test-study - name: publish-test-study
commands: commands:
#拉取代码 并停止服务 - echo start publish test-study-api
- Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait - cd /opt/1panel/hang/devops/test-study
- cd C:\CICD\Test.Study\netcore_repo - sh test-study.sh v${DRONE_BUILD_NUMBER}
- dotnet restore .\IRaCIS.Core.API\IRaCIS.Core.API.csproj --packages C:\Users\Administrator\.nuget\packages
- dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -c Release --no-restore --packages C:\Users\Administrator\.nuget\packages -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API
- Start-Service -Name "Test_Study_API"
trigger: trigger:
branch: branch:
- Test.Study - Test.Study
---
kind: pipeline
type: ssh
name: ssh-windows-test-irc-publish
platform:
os: windows
arch: amd64
clone:
disable: true #禁用默认克隆
server:
host: 123.56.94.154
user: Administrator
password: WHxckj2019
steps:
- name: publish-test-irc
commands:
- Start-Process "C:\CICD\Test.IRC\netcore_Publish.bat" -Wait
trigger:
branch:
- Test.IRC