feat(workflows): introduce Artifacts BE-12919 (#2740)

This commit is contained in:
andres-portainer
2026-05-26 16:17:32 -03:00
committed by GitHub
parent 7164146626
commit ab4626e7de
32 changed files with 1433 additions and 271 deletions
@@ -33,6 +33,9 @@ func TestStackUpdateGitWebhookUniqueness(t *testing.T) {
err = store.Endpoint().Create(endpoint)
require.NoError(t, err)
const stack1ID = portainer.StackID(456)
const stack2ID = portainer.StackID(457)
src1 := &portainer.Source{
Type: portainer.SourceTypeGit,
GitConfig: &gittypes.RepoConfig{URL: "https://github.com/portainer/portainer.git"},
@@ -40,7 +43,10 @@ func TestStackUpdateGitWebhookUniqueness(t *testing.T) {
err = store.Source().Create(src1)
require.NoError(t, err)
wf1 := &portainer.Workflow{SourceIDs: []portainer.SourceID{src1.ID}}
wf1 := &portainer.Workflow{Artifacts: []portainer.ArtifactSources{{
Artifact: portainer.Artifact{StackID: stack1ID},
SourceIDs: []portainer.SourceID{src1.ID},
}}}
err = store.Workflow().Create(wf1)
require.NoError(t, err)
@@ -51,12 +57,15 @@ func TestStackUpdateGitWebhookUniqueness(t *testing.T) {
err = store.Source().Create(src2)
require.NoError(t, err)
wf2 := &portainer.Workflow{SourceIDs: []portainer.SourceID{src2.ID}}
wf2 := &portainer.Workflow{Artifacts: []portainer.ArtifactSources{{
Artifact: portainer.Artifact{StackID: stack2ID},
SourceIDs: []portainer.SourceID{src2.ID},
}}}
err = store.Workflow().Create(wf2)
require.NoError(t, err)
stack1 := portainer.Stack{
ID: 456,
ID: stack1ID,
EndpointID: endpoint.ID,
WorkflowID: wf1.ID,
AutoUpdate: &portainer.AutoUpdateSettings{
@@ -68,7 +77,7 @@ func TestStackUpdateGitWebhookUniqueness(t *testing.T) {
require.NoError(t, err)
stack2 := stack1
stack2.ID++
stack2.ID = stack2ID
stack2.AutoUpdate = nil
stack2.WorkflowID = wf2.ID