feat(CI): 测试推送到Nexus3
continuous-integration/drone Build is failing Details

develop
Yosheng 2023-08-05 17:33:47 +08:00
parent 8d75ec84e0
commit 9376c4b14e
4 changed files with 32 additions and 14 deletions

View File

@ -1,8 +1,24 @@
kind: pipeline # 定义一个管道 kind: pipeline
type: docker # 当前管道的类型 type: docker
name: test # 当前管道的名称 name: deployment
steps: # 定义管道的执行步骤 steps:
- name: test # 步骤名称 - name: check
image: node:latest # 当前步骤使用的镜像 image: alpine
commands: # 当前步骤执行的命令 commands:
- echo 测试drone执行 - ls -la
- ls -la Dockerfile --查看当前文件夹是否包含了Dockerfile
- name: publish
image: plugins/docker
settings:
dockerfile: Dockerfile
tags: latest
# you need insecure: true since we don't have a TLS certificate
insecure: true
registry: 192.168.31.104:8082
repo: 192.168.31.104:8082/tiamo/user-point-management
# create the docker_username and docker_password secrets in Drone, with Nexus' username & password
secrets: [ drone, dronepw ]
#trigger:
# branch:
# - master

View File

@ -37,7 +37,7 @@ public class UserService : IUserService
queryable = queryable.Where(x => x.Mobile.Contains(req.Keyword) || x.Name.Contains(req.Keyword), queryable = queryable.Where(x => x.Mobile.Contains(req.Keyword) || x.Name.Contains(req.Keyword),
!string.IsNullOrEmpty(req.Keyword)); !string.IsNullOrEmpty(req.Keyword));
var count = queryable.Count(); var count = queryable.Count();
var data = await queryable.OrderByDescending(x => x.Id).Paging(req).ToListAsync().ConfigureAwait(false); var data = await queryable.OrderByDescending(x => x.Id).Paging(req).ToListAsync().ConfigureAwait(false);
@ -63,7 +63,8 @@ public class UserService : IUserService
public async Task CreateUser(User input) public async Task CreateUser(User input)
{ {
await using var _userPointManagementDbContext = await _dbContextFactory.CreateDbContextAsync(); await using var _userPointManagementDbContext = await _dbContextFactory.CreateDbContextAsync();
if (!string.IsNullOrWhiteSpace(input.Mobile) && _userPointManagementDbContext.Users.Any(x => x.Mobile == input.Mobile)) if (!string.IsNullOrWhiteSpace(input.Mobile) &&
_userPointManagementDbContext.Users.Any(x => x.Mobile == input.Mobile))
{ {
throw new ArgumentException("手机号不可重复!"); throw new ArgumentException("手机号不可重复!");
} }
@ -72,6 +73,7 @@ public class UserService : IUserService
{ {
throw new ArgumentException("名称不可重复!"); throw new ArgumentException("名称不可重复!");
} }
_userPointManagementDbContext.Users.Add(input); _userPointManagementDbContext.Users.Add(input);
await _userPointManagementDbContext.SaveChangesAsync().ConfigureAwait(false); await _userPointManagementDbContext.SaveChangesAsync().ConfigureAwait(false);
} }

View File

@ -9,10 +9,10 @@ public class UserConfiguration : IEntityTypeConfiguration<User>
public void Configure(EntityTypeBuilder<User> builder) public void Configure(EntityTypeBuilder<User> builder)
{ {
builder.HasKey(e => e.Id); builder.HasKey(e => e.Id);
builder.Property(e => e.Id) builder.Property(e => e.Id)
.HasComment("主键"); .HasComment("主键");
builder.Property(e => e.Name) builder.Property(e => e.Name)
.HasComment("姓名") .HasComment("姓名")
.HasMaxLength(50); .HasMaxLength(50);

View File

@ -9,9 +9,9 @@ public class UserPointManagementDbContext : Microsoft.EntityFrameworkCore.DbCont
public UserPointManagementDbContext(DbContextOptions options) : base(options) public UserPointManagementDbContext(DbContextOptions options) : base(options)
{ {
} }
public virtual DbSet<User> Users { get; set; } public virtual DbSet<User> Users { get; set; }
public virtual DbSet<UserPoint> UserPoints { get; set; } public virtual DbSet<UserPoint> UserPoints { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)