From ccd6ea5409eb61fbac58a83b2d4f0de2f5fa7c2d Mon Sep 17 00:00:00 2001 From: Al Cutter Date: Wed, 13 Dec 2023 19:18:31 +0100 Subject: [PATCH] Add distributor URL substitution (#181) --- Dockerfile | 4 +++- Makefile | 6 +++--- release/cloudbuild.yaml | 2 ++ release/cloudbuild_ci.yaml | 2 ++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4082d23..4163fd9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ ARG APPLET_PUBLIC_KEY ARG OS_PUBLIC_KEY1 ARG OS_PUBLIC_KEY2 ARG GIT_SEMVER_TAG +ARG REST_DISTRIBUTOR_BASE_URL # Install dependencies. RUN apt-get update && apt-get install -y git make wget @@ -37,6 +38,7 @@ ENV FT_LOG_URL=${FT_LOG_URL} \ APPLET_PUBLIC_KEY="/tmp/applet.pub" \ OS_PUBLIC_KEY1="/tmp/os1.pub" \ OS_PUBLIC_KEY2="/tmp/os2.pub" \ - GIT_SEMVER_TAG=${GIT_SEMVER_TAG} + GIT_SEMVER_TAG=${GIT_SEMVER_TAG} \ + REST_DISTRIBUTOR_BASE_URL=${REST_DISTRIBUTOR_BASE_URL} RUN make trusted_applet_nosign diff --git a/Makefile b/Makefile index 79111d4..761cd87 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,9 @@ BUILD_EPOCH := $(shell /bin/date -u "+%s") BUILD_TAGS = linkramsize,linkramstart,disable_fr_auth,linkprintk,nostatfs REV = $(shell git rev-parse --short HEAD 2> /dev/null) GIT_SEMVER_TAG ?= $(shell (git describe --tags --exact-match --match 'v*.*.*' 2>/dev/null || git describe --match 'v*.*.*' --tags 2>/dev/null || git describe --tags 2>/dev/null || echo -n v0.0.${BUILD_EPOCH}+`git rev-parse HEAD`) | tail -c +2 ) -FT_BIN_URL ?= "http://$(shell hostname --fqdn):9944/artefacts/" -FT_LOG_URL ?= "http://$(shell hostname --fqdn):9944/log/" -REST_DISTRIBUTOR_BASE_URL ?= "https://api.transparency.dev" +FT_BIN_URL ?= http://$(shell hostname --fqdn):9944/artefacts/ +FT_LOG_URL ?= http://$(shell hostname --fqdn):9944/log/ +REST_DISTRIBUTOR_BASE_URL ?= https://api.transparency.dev TAMAGO_SEMVER = $(shell [ -n "${TAMAGO}" -a -x "${TAMAGO}" ] && ${TAMAGO} version | sed 's/.*go\([0-9]\.[0-9]*\.[0-9]*\).*/\1/') MINIMUM_TAMAGO_VERSION=1.21.3 diff --git a/release/cloudbuild.yaml b/release/cloudbuild.yaml index 9dfe6e7..9baea3e 100644 --- a/release/cloudbuild.yaml +++ b/release/cloudbuild.yaml @@ -12,6 +12,7 @@ steps: - --build-arg=APPLET_PUBLIC_KEY=${_APPLET_PUBLIC_KEY} - --build-arg=OS_PUBLIC_KEY1=${_OS_PUBLIC_KEY1} - --build-arg=OS_PUBLIC_KEY2=${_OS_PUBLIC_KEY2} + - --build-arg=REST_DISTRIBUTOR_BASE_URL=${_REST_DISTRIBUTOR_BASE_URL} - -t - builder-image # Path is relative to the root of the repo. @@ -129,3 +130,4 @@ substitutions: _APPLET_PUBLIC_KEY: transparency.dev-aw-applet-prod+f022187a+AZSnFa8GxH+jHV6ahELk6peqVObbPKrYAdYyMjrzNF35 _OS_PUBLIC_KEY1: transparency.dev-aw-os-prod+03170554+AV7mmRamQp6VC9CutzSXzqtNhYNyNmQQRcLX07F6qlC1 _OS_PUBLIC_KEY2: TODO + _REST_DISTRIBUTOR_BASE_URL: https://api.transparency.dev diff --git a/release/cloudbuild_ci.yaml b/release/cloudbuild_ci.yaml index fe8542e..ffc4bb6 100644 --- a/release/cloudbuild_ci.yaml +++ b/release/cloudbuild_ci.yaml @@ -26,6 +26,7 @@ steps: --build-arg=OS_PUBLIC_KEY1=${_OS_PUBLIC_KEY1} \ --build-arg=OS_PUBLIC_KEY2=${_OS_PUBLIC_KEY2} \ --build-arg=GIT_SEMVER_TAG=$(cat /workspace/fake_tag) \ + --build-arg=REST_DISTRIBUTOR_BASE_URL=${_REST_DISTRIBUTOR_BASE_URL} \ -t builder-image \ . # Prepare a container with a copy of the artifacts. @@ -128,3 +129,4 @@ substitutions: _APPLET_PUBLIC_KEY: transparency.dev-aw-applet-ci+3ff32e2c+AV1fgxtByjXuPjPfi0/7qTbEBlPGGCyxqr6ZlppoLOz3 _OS_PUBLIC_KEY1: transparency.dev-aw-os1-ci+7a0eaef3+AcsqvmrcKIbs21H2Bm2fWb6oFWn/9MmLGNc6NLJty2eQ _OS_PUBLIC_KEY2: transparency.dev-aw-os2-ci+af8e4114+AbBJk5MgxRB+68KhGojhUdSt1ts5GAdRIT1Eq9zEkgQh + _REST_DISTRIBUTOR_BASE_URL: https://api.transparency.dev