ci: fix misc and refactorings (#4994)
* ci: fix misc and refactorings * ci: additional fixpull/4995/head
parent
024004f5a1
commit
ac72ee494c
|
@ -5,5 +5,7 @@
|
|||
"RememberMe":"{{ .RememberMe }}",
|
||||
"ResetPassword":"{{ .ResetPassword }}",
|
||||
"ResetPasswordCustomURL":"{{ .ResetPasswordCustomURL }}",
|
||||
"PrivacyPolicyURL":"{{ .PrivacyPolicyURL }}",
|
||||
"PrivacyPolicyAccept":"{{ .PrivacyPolicyAccept }}",
|
||||
"Theme":"{{ .Theme }}"
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
envFileProd = "./web/.env.production"
|
||||
envFileDev = "./web/.env.development"
|
||||
envFileProd = "/web/.env.production"
|
||||
envFileDev = "/web/.env.development"
|
||||
namespaceAuthelia = "authelia"
|
||||
namespaceDashboard = "kubernetes-dashboard"
|
||||
namespaceKube = "kube-system"
|
||||
|
|
|
@ -19,14 +19,12 @@ func init() {
|
|||
"internal/suites/example/compose/samba/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, activedirectorySuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, activedirectorySuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -19,14 +19,12 @@ func init() {
|
|||
"internal/suites/example/compose/smtp/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, bypassAllSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, bypassAllSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -32,14 +32,12 @@ func init() {
|
|||
})
|
||||
}
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, caddySuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, caddySuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ func init() {
|
|||
"internal/suites/example/compose/authelia/docker-compose.backend.{}.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
if err := dockerEnvironment.Up(); err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,12 @@ func init() {
|
|||
"internal/suites/example/compose/smtp/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, dockerSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, dockerSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -19,14 +19,12 @@ func init() {
|
|||
"internal/suites/example/compose/duo-api/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, duoPushSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, duoPushSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -32,14 +32,12 @@ func init() {
|
|||
})
|
||||
}
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, envoySuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, envoySuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -32,14 +32,12 @@ func init() {
|
|||
})
|
||||
}
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, haproxySuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, haproxySuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,12 @@ var haDockerEnvironment = NewDockerEnvironment([]string{
|
|||
})
|
||||
|
||||
func init() {
|
||||
setup := func(suitePath string) error {
|
||||
err := haDockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = haDockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(haDockerEnvironment, highAvailabilitySuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(haDockerEnvironment, highAvailabilitySuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,12 @@ func init() {
|
|||
"internal/suites/example/compose/ldap/docker-compose.admin.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, ldapSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, ldapSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,12 @@ func init() {
|
|||
"internal/suites/example/compose/ldap/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, mariadbSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, mariadbSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -18,13 +18,16 @@ var multiCookieDomainDockerEnvironment = NewDockerEnvironment([]string{
|
|||
})
|
||||
|
||||
func init() {
|
||||
setup := func(suitePath string) error {
|
||||
err := multiCookieDomainDockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = multiCookieDomainDockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return waitUntilAutheliaIsReady(multiCookieDomainDockerEnvironment, multiCookieDomainSuiteName)
|
||||
if err = waitUntilAutheliaIsReady(multiCookieDomainDockerEnvironment, multiCookieDomainSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return updateDevEnvFileForDomain(BaseDomain, true)
|
||||
}
|
||||
|
||||
displayAutheliaLogs := func() error {
|
||||
|
|
|
@ -20,14 +20,12 @@ func init() {
|
|||
"internal/suites/example/compose/ldap/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, mysqlSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, mysqlSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -21,14 +21,12 @@ func init() {
|
|||
"internal/suites/example/compose/httpbin/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, networkACLSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, networkACLSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -20,21 +20,18 @@ func init() {
|
|||
"internal/suites/example/compose/redis/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
setup := func(suitePath string) (err error) {
|
||||
// TODO(c.michaud): use version in tags for oidc-client but in the meantime we pull the image to make sure it's
|
||||
// up to date.
|
||||
err := dockerEnvironment.Pull("oidc-client")
|
||||
if err != nil {
|
||||
if err = dockerEnvironment.Pull("oidc-client"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, oidcSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, oidcSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -34,21 +34,18 @@ func init() {
|
|||
})
|
||||
}
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
setup := func(suitePath string) (err error) {
|
||||
// TODO(c.michaud): use version in tags for oidc-client but in the meantime we pull the image to make sure it's
|
||||
// up to date.
|
||||
err := dockerEnvironment.Pull("oidc-client")
|
||||
if err != nil {
|
||||
if err = dockerEnvironment.Pull("oidc-client"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, oidcTraefikSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, oidcTraefikSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@ func init() {
|
|||
"internal/suites/example/compose/nginx/portal/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, oneFactorOnlySuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, oneFactorOnlySuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -32,14 +32,12 @@ func init() {
|
|||
})
|
||||
}
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, pathPrefixSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, pathPrefixSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,12 @@ func init() {
|
|||
"internal/suites/example/compose/ldap/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, postgresSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, postgresSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,12 @@ func init() {
|
|||
"internal/suites/example/compose/smtp/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, shortTimeoutsSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, shortTimeoutsSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,12 @@ func init() {
|
|||
"internal/suites/example/compose/smtp/docker-compose.yml",
|
||||
})
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, standaloneSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, standaloneSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -32,14 +32,12 @@ func init() {
|
|||
})
|
||||
}
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := dockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = dockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(dockerEnvironment, traefikSuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(dockerEnvironment, traefikSuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -34,14 +34,12 @@ func init() {
|
|||
})
|
||||
}
|
||||
|
||||
setup := func(suitePath string) error {
|
||||
err := traefik2DockerEnvironment.Up()
|
||||
if err != nil {
|
||||
setup := func(suitePath string) (err error) {
|
||||
if err = traefik2DockerEnvironment.Up(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = waitUntilAutheliaIsReady(traefik2DockerEnvironment, traefik2SuiteName)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaIsReady(traefik2DockerEnvironment, traefik2SuiteName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -241,8 +241,8 @@ func fixCoveragePath(path string, file os.FileInfo, err error) error {
|
|||
|
||||
// getEnvInfoFromURL gets environments variables for specified cookie domain
|
||||
// this func makes a http call to https://login.<domain>/devworkflow and is only useful for suite tests.
|
||||
func getDomainEnvInfo(domain string) (map[string]string, error) {
|
||||
info := make(map[string]string)
|
||||
func getDomainEnvInfo(domain string) (info map[string]string, err error) {
|
||||
info = make(map[string]string)
|
||||
|
||||
client := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
|
@ -256,7 +256,6 @@ func getDomainEnvInfo(domain string) (map[string]string, error) {
|
|||
req *http.Request
|
||||
resp *http.Response
|
||||
body []byte
|
||||
err error
|
||||
)
|
||||
|
||||
targetURL := LoginBaseURLFmt(domain) + "/devworkflow"
|
||||
|
@ -285,16 +284,20 @@ func getDomainEnvInfo(domain string) (map[string]string, error) {
|
|||
}
|
||||
|
||||
// generateDevEnvFile generates web/.env.development based on opts.
|
||||
func generateDevEnvFile(opts map[string]string) error {
|
||||
tmpl, err := template.ParseFiles(envFileProd)
|
||||
if err != nil {
|
||||
func generateDevEnvFile(info map[string]string) (err error) {
|
||||
base, _ := os.Getwd()
|
||||
base = strings.TrimSuffix(base, "/internal/suites")
|
||||
|
||||
var tmpl *template.Template
|
||||
|
||||
if tmpl, err = template.ParseFiles(base + envFileProd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
file, _ := os.Create(envFileDev)
|
||||
file, _ := os.Create(base + envFileDev)
|
||||
defer file.Close()
|
||||
|
||||
if err := tmpl.Execute(file, opts); err != nil {
|
||||
if err = tmpl.Execute(file, info); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -303,29 +306,28 @@ func generateDevEnvFile(opts map[string]string) error {
|
|||
|
||||
// updateDevEnvFileForDomain updates web/.env.development.
|
||||
// this function only affects local dev environments.
|
||||
func updateDevEnvFileForDomain(domain string, setup bool) error {
|
||||
func updateDevEnvFileForDomain(domain string, setup bool) (err error) {
|
||||
if os.Getenv("CI") == t {
|
||||
return nil
|
||||
}
|
||||
|
||||
if _, err := os.Stat(envFileDev); err != nil && os.IsNotExist(err) {
|
||||
if _, err = os.Stat(envFileDev); err != nil && os.IsNotExist(err) {
|
||||
file, _ := os.Create(envFileDev)
|
||||
file.Close()
|
||||
}
|
||||
|
||||
info, err := getDomainEnvInfo(domain)
|
||||
if err != nil {
|
||||
var info map[string]string
|
||||
|
||||
if info, err = getDomainEnvInfo(domain); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = generateDevEnvFile(info)
|
||||
if err != nil {
|
||||
if err = generateDevEnvFile(info); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !setup {
|
||||
err = waitUntilAutheliaFrontendIsReady(multiCookieDomainDockerEnvironment)
|
||||
if err != nil {
|
||||
if err = waitUntilAutheliaFrontendIsReady(multiCookieDomainDockerEnvironment); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue