Skip to content

Commit

Permalink
Always update expiration time when creating an artifact (#32281)
Browse files Browse the repository at this point in the history
Fix #32256
  • Loading branch information
Zettat123 authored Oct 17, 2024
1 parent 2b8ff41 commit 9116665
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion models/actions/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func CreateArtifact(ctx context.Context, t *ActionTask, artifactName, artifactPa
OwnerID: t.OwnerID,
CommitSHA: t.CommitSHA,
Status: int64(ArtifactStatusUploadPending),
ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + 3600*24*expiredDays),
ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + timeutil.Day*expiredDays),
}
if _, err := db.GetEngine(ctx).Insert(artifact); err != nil {
return nil, err
Expand All @@ -78,6 +78,13 @@ func CreateArtifact(ctx context.Context, t *ActionTask, artifactName, artifactPa
} else if err != nil {
return nil, err
}

if _, err := db.GetEngine(ctx).ID(artifact.ID).Cols("expired_unix").Update(&ActionArtifact{
ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + timeutil.Day*expiredDays),
}); err != nil {
return nil, err
}

return artifact, nil
}

Expand Down

0 comments on commit 9116665

Please sign in to comment.