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 # 定义一个管道
type: docker # 当前管道的类型
name: test # 当前管道的名称
steps: # 定义管道的执行步骤
- name: test # 步骤名称
image: node:latest # 当前步骤使用的镜像
commands: # 当前步骤执行的命令
- echo 测试drone执行
kind: pipeline
type: docker
name: deployment
steps:
- name: check
image: alpine
commands:
- 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),
!string.IsNullOrEmpty(req.Keyword));
var count = queryable.Count();
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)
{
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("手机号不可重复!");
}
@ -72,6 +73,7 @@ public class UserService : IUserService
{
throw new ArgumentException("名称不可重复!");
}
_userPointManagementDbContext.Users.Add(input);
await _userPointManagementDbContext.SaveChangesAsync().ConfigureAwait(false);
}

View File

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

View File

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