From e66f8496199ee884a26f90948e34903915ed24fd Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Wed, 24 Jun 2020 15:22:30 -0400 Subject: [PATCH 1/3] website: declare dotenv dependency --- website/package-lock.json | 6 ++++++ website/package.json | 1 + 2 files changed, 7 insertions(+) diff --git a/website/package-lock.json b/website/package-lock.json index d12328f88..dac80880d 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -5931,6 +5931,12 @@ } } }, + "dotenv": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", + "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", + "dev": true + }, "download": { "version": "6.2.5", "resolved": "https://registry.npmjs.org/download/-/download-6.2.5.tgz", diff --git a/website/package.json b/website/package.json index d2d854d80..509cf392f 100644 --- a/website/package.json +++ b/website/package.json @@ -42,6 +42,7 @@ "devDependencies": { "dart-linkcheck": "^2.0.15", "husky": "^4.2.5", + "dotenv": "^8.2.0", "prettier": "^2.0.5" }, "husky": { From 15b84be0e680009f00f54dfe015c93427809956e Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Wed, 24 Jun 2020 15:28:57 -0400 Subject: [PATCH 2/3] Tweak algolia scripts Avoid running algolia job in forks or enterprise private repositories --- .circleci/config.yml | 11 +++++++---- .circleci/config/jobs/algolia_index.yml | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dfbe78a7f..ab883dee4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1050,15 +1050,18 @@ jobs: - PAGER: cat algolia_index: docker: - - image: circleci/buildpack-deps - shell: /usr/bin/env bash -euo pipefail -c + - image: node:10 steps: - checkout - - setup_remote_docker - run: command: | + if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/nomad.git" ]; then + echo "Not Nomad OSS Repo, not indexing Algolia" + exit 0 + fi + cd website/ - npm i + npm install node scripts/index_search_content.js name: Push content to Algolia Index test-docker: diff --git a/.circleci/config/jobs/algolia_index.yml b/.circleci/config/jobs/algolia_index.yml index 889e87abc..a725bd853 100644 --- a/.circleci/config/jobs/algolia_index.yml +++ b/.circleci/config/jobs/algolia_index.yml @@ -1,12 +1,15 @@ docker: - - image: circleci/buildpack-deps -shell: /usr/bin/env bash -euo pipefail -c + - image: node:10 steps: - checkout - - setup_remote_docker - run: name: Push content to Algolia Index command: | + if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/nomad.git" ]; then + echo "Not Nomad OSS Repo, not indexing Algolia" + exit 0 + fi + cd website/ - npm i + npm install node scripts/index_search_content.js From 2c5d4f86cbbcfd80e386b76205a40cdd7be000ce Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Wed, 24 Jun 2020 21:16:15 -0400 Subject: [PATCH 3/3] use node 12 --- .circleci/config.yml | 2 +- .circleci/config/jobs/algolia_index.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ab883dee4..8ec51a558 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1050,7 +1050,7 @@ jobs: - PAGER: cat algolia_index: docker: - - image: node:10 + - image: node:12 steps: - checkout - run: diff --git a/.circleci/config/jobs/algolia_index.yml b/.circleci/config/jobs/algolia_index.yml index a725bd853..c9cca948a 100644 --- a/.circleci/config/jobs/algolia_index.yml +++ b/.circleci/config/jobs/algolia_index.yml @@ -1,5 +1,5 @@ docker: - - image: node:10 + - image: node:12 steps: - checkout - run: