Skip to content

Commit

Permalink
wip: moved wait and added 422 check in CreateReadOnlyUser()
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanHoladay committed Dec 19, 2023
1 parent 7ce9de5 commit 21a9c7d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 7 additions & 6 deletions packages/gitea/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ components:
- name: GIT_SERVER_CREATE_PVC
mute: true
after:
- wait:
cluster:
kind: pod
namespace: zarf
name: app=gitea
condition: Ready
- cmd: ./zarf internal create-read-only-gitea-user --no-progress
maxRetries: 3
maxTotalSeconds: 60
Expand All @@ -79,11 +85,6 @@ components:
maxRetries: 3
maxTotalSeconds: 60
description: Create an artifact registry token
- wait:
cluster:
kind: pod
namespace: zarf
name: app=gitea
condition: Ready

onFailure:
- cmd: ./zarf internal update-gitea-pvc --rollback --no-progress
7 changes: 6 additions & 1 deletion src/internal/packager/git/gitea.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"io"
"os"
"strings"
"time"

netHttp "net/http"
Expand Down Expand Up @@ -75,7 +76,11 @@ func (g *Git) CreateReadOnlyUser() error {
})
message.Debugf("POST %s:\n%s", createUserEndpoint, string(out))
if err != nil {
return err
if strings.Contains(err.Error(), "422") {
message.Debugf("Read-only git user already exists. Skipping...")
} else {
return err
}
}

// Make sure the user can't create their own repos or orgs
Expand Down

0 comments on commit 21a9c7d

Please sign in to comment.