From 247719f2c587791b664631494f883805dc7f826c Mon Sep 17 00:00:00 2001 From: jay-dee7 Date: Sat, 20 Nov 2021 21:43:52 +0530 Subject: [PATCH] Fix: Failing github action for OCI Conformance Signed-off-by: jay-dee7 --- .github/workflows/conformance.yml | 2 ++ config/config.go | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index 0d1a9735..56f4e972 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -20,6 +20,8 @@ jobs: echo "OCI_ROOT_URL=http://$IP:5000" >> $GITHUB_ENV DISTRIBUTION_REF="local-distribution:v$(date +%Y%m%d%H%M%S)" docker build -f ./Dockerfile -t "${DISTRIBUTION_REF}" . + sed -in "s/OPEN_REGISTRY_ENVIRONMENT=local/OPEN_REGISTRY_ENVIRONMENT=ci/g" env-vars.example + echo CI_SYS_ADDR=$IP:5000 >> env-vars.example docker run --rm -p 5000:5000 --env-file ./env-vars.example -e REGISTRY_STORAGE_DELETE_ENABLED=true -d "${DISTRIBUTION_REF}" sleep 5 curl -XPOST -d ${{ secrets.OPENREGISTRY_SIGNUP_PAYLOAD }} "http://${IP}:5000/auth/signup" diff --git a/config/config.go b/config/config.go index 2bb78f6b..7ac92b82 100644 --- a/config/config.go +++ b/config/config.go @@ -2,6 +2,7 @@ package config import ( "fmt" + "log" "os" "strings" @@ -102,8 +103,15 @@ func (r *RegistryConfig) Endpoint() string { return fmt.Sprintf("http://%s:%d", r.Host, r.Port) case Prod, Stage: return fmt.Sprintf("https://%s", r.DNSAddress) + case CI: + ciSysAddr := os.Getenv("CI_SYS_ADDR") + if ciSysAddr == "" { + log.Fatalln("missing required environment variable: CI_SYS_ADDR") + } + + return fmt.Sprintf("http://%s", ciSysAddr) default: - return fmt.Sprintf("http://%s:%d", r.Host, r.Port) + return fmt.Sprintf("https://%s:%d", r.Host, r.Port) } } @@ -112,4 +120,5 @@ const ( Stage = "stage" Dev = "development" Local = "local" + CI = "ci" )