From 1d4ae6a31027992781e947f23ae17d2f49af965e Mon Sep 17 00:00:00 2001 From: GbArc Date: Wed, 7 Aug 2024 15:33:51 +0200 Subject: [PATCH 1/4] build script with aida replacement --- scripts/k8s-build.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 scripts/k8s-build.sh diff --git a/scripts/k8s-build.sh b/scripts/k8s-build.sh new file mode 100755 index 0000000000..844092fc2f --- /dev/null +++ b/scripts/k8s-build.sh @@ -0,0 +1,9 @@ +#!/bin/bash +echo "Rebuilding web" +cp -rT /app /build +if [ ! -z AIDA_URL ]; then + echo "Replacing aida.js with $AIDA_URL" + curl -o /build/node_modules/asktravis/dist/aida.js $AIDA_URL + curl -o /build/node_modules/asktravis/dist/aida.js.map $AIDA_URL.map || true +fi +cd /build && ember build --environment=${ENV:-production} From 1555bfe4d10c40c120ff1b549fa1b0d039aeff5e Mon Sep 17 00:00:00 2001 From: GbArc Date: Thu, 8 Aug 2024 10:27:17 +0200 Subject: [PATCH 2/4] allowing aida_url for enterprise --- Dockerfile.tcie | 8 ++++++-- Makefile | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile.tcie b/Dockerfile.tcie index 4900e05c48..0b9e13abef 100644 --- a/Dockerfile.tcie +++ b/Dockerfile.tcie @@ -6,6 +6,8 @@ ENV NPM_CONFIG_LOGLEVEL info ENV NODE_VERSION 18.19.0 ENV YARN_VERSION 0.22.0 +ARG AIDA_URL + RUN ( \ groupadd --gid 1000 node \ && useradd --uid 1000 --gid node --shell /bin/bash --create-home node; \ @@ -31,9 +33,11 @@ RUN --mount=type=secret,id=GITHUB_PERSONAL_TOKEN export GITHUB_PERSONAL_TOKEN=$( RUN (\ npm install --silent -g ember-cli; \ npm ci; \ + if test $AIDA_URL; then \ + curl -o /app/node_modules/asktravis/dist/aida.js $AIDA_URL; \ + curl -o /app/node_modules/asktravis/dist/aida.js.map $AIDA_URL.map || true; \ + fi; \ ember build --environment=production; \ - ls -l /app; \ - ls -l /app/dist; \ ) FROM ruby:3.2.2-slim diff --git a/Makefile b/Makefile index b4b210016e..3202d67cb0 100644 --- a/Makefile +++ b/Makefile @@ -23,11 +23,16 @@ ifdef $$TRAVIS_PULL_REQUEST TRAVIS_PULL_REQUEST := $$TRAVIS_PULL_REQUEST endif + +ifndef $$AIDA_URL + AIDA_URL ?= $$AIDA_URL +endif + DOCKER ?= docker .PHONY: docker-build docker-build: - $(DOCKER) build --progress=plain --pull --no-cache -t $(DOCKER_DEST) . -f Dockerfile.tcie --secret id=GITHUB_PERSONAL_TOKEN,env=GITHUB_PERSONAL_TOKEN + $(DOCKER) build --progress=plain --pull --no-cache -t $(DOCKER_DEST) . -f Dockerfile.tcie --secret id=GITHUB_PERSONAL_TOKEN,env=GITHUB_PERSONAL_TOKEN --build-arg AIDA_URL="$(AIDA_URL)" .PHONY: docker-login docker-login: From 9a216dab5269641e8150b4e7069c82a2ef02dd43 Mon Sep 17 00:00:00 2001 From: GbArc Date: Thu, 8 Aug 2024 14:12:33 +0200 Subject: [PATCH 3/4] readme update with AIDA_URL info --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 5b0627469c..ed2760ed8d 100644 --- a/README.md +++ b/README.md @@ -156,3 +156,7 @@ pull request deployments. You can visit these deployments at: These deployments are also performed with the weekly cron build. + +### Ask Travis updates + + Note that scripts/k8s-deploy.sh script is started on each deployment. If there's an AIDA_URL env defined - aida.js will be downloaded from this URL and replace the original delivered in asktravis package. From f2998e40ffcd2a08733e9e9e991e28fc15916e10 Mon Sep 17 00:00:00 2001 From: GbArc Date: Fri, 16 Aug 2024 08:51:19 +0200 Subject: [PATCH 4/4] build script change - now in docker --- Dockerfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 934b4cefd1..ff083ed8f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,8 @@ FROM ruby:3.2.2 LABEL maintainer Travis CI GmbH +ARG AIDA_URL + RUN groupadd --gid 1000 node \ && useradd --uid 1000 --gid node --shell /bin/bash --create-home node @@ -39,8 +41,14 @@ COPY . /app RUN --mount=type=secret,id=GITHUB_PERSONAL_TOKEN export GITHUB_PERSONAL_TOKEN=$(cat /run/secrets/GITHUB_PERSONAL_TOKEN) && git config --global url."https://$GITHUB_PERSONAL_TOKEN@github.com/".insteadOf ssh://git@github.com -RUN npm ci -RUN ember build --environment=production +RUN (\ + npm ci; \ + if test $AIDA_URL; then \ + curl -o /app/node_modules/asktravis/dist/aida.js $AIDA_URL; \ + curl -o /app/node_modules/asktravis/dist/aida.js.map $AIDA_URL.map || true; \ + fi; \ + ember build --environment=production; \ +) RUN cp -a public/* dist/