Skip to content

Commit 9e912ba

Browse files
committed
update
1 parent 5c6c4fd commit 9e912ba

File tree

10 files changed

+11936
-8501
lines changed

10 files changed

+11936
-8501
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.yarn/releases/** binary
2+
/.yarn/plugins/** binary

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,14 @@ static/images/integrations_logos/2020w2.pdf
202202
# Generated resources from Hugo Pipes
203203
resources/_gen/
204204
static/jsconfig.json
205+
206+
# yarn v2 or greater
207+
# Not using zero installs
208+
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
209+
.pnp.*
210+
.yarn/*
211+
!.yarn/patches
212+
!.yarn/plugins
213+
!.yarn/releases
214+
!.yarn/sdks
215+
!.yarn/versions

.gitlab-ci.yml

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ variables:
1818
# gitlab checkout
1919
DOCS_REPO_NAME: documentation
2020
REPO_URL: "https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/${DOCS_REPO_NAME}.git"
21+
# yarn/node cache dirs
22+
YARN_CACHE_FOLDER: "${CI_PROJECT_DIR}/.yarn/cache/"
2123

2224
# ================== copy scripts =============== #
2325
before_script:
@@ -27,11 +29,27 @@ before_script:
2729
- "[ -f /etc/profile ] && source /etc/profile" # for golang on path
2830
- mkdir -p logs
2931

30-
cache: &cache
31-
key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
32-
paths:
33-
- node_modules/
34-
- tmp/.htmltest/
32+
# set policy for the common case
33+
# yarn cache is used in a lot but only built during build job so lets default to pull and explicit push in build job
34+
.yarn_cache: &yarn_cache
35+
- key:
36+
files:
37+
- yarn.lock
38+
paths:
39+
- package.json
40+
- yarn.lock
41+
- ${YARN_CACHE_FOLDER}
42+
policy: pull
43+
44+
.yarn_cache_pull_push: &yarn_cache_pull_push
45+
- key:
46+
files:
47+
- yarn.lock
48+
paths:
49+
- package.json
50+
- yarn.lock
51+
- ${YARN_CACHE_FOLDER}
52+
policy: pull-push
3553

3654
# ================== templates ================== #
3755
.base_template: &base_template
@@ -43,35 +61,13 @@ cache: &cache
4361
only:
4462
- branches
4563

46-
# ================== Install Node Dependencies ================== #
47-
install_dependencies:
48-
<<: *base_template
49-
stage: bootstrap
50-
cache:
51-
<<: *cache
52-
variables:
53-
GIT_STRATEGY: none
54-
script:
55-
- git version
56-
- git clone --branch $CI_COMMIT_REF_NAME --depth 1 --filter=blob:none --no-checkout $REPO_URL sparse-docs
57-
- cd sparse-docs && git sparse-checkout init --cone && git sparse-checkout set local && git checkout $CI_COMMIT_REF_NAME && cd ..
58-
- mkdir -p ./local/bin/sh && cp --remove-destination ./sparse-docs/local/bin/sh/preinstall.sh ./local/bin/sh/preinstall.sh
59-
- cp --remove-destination ./sparse-docs/package.json ./package.json
60-
- cp --remove-destination ./sparse-docs/yarn.lock ./yarn.lock
61-
- yarn install --link-duplicates --frozen-lockfile --cache-folder .yarn
62-
- rm -rf ./sparse-docs # cleanup runner
63-
only:
64-
changes:
65-
- yarn.lock
66-
6764
# ================== preview ================== #
6865
# If the branch has a name of <slack-user>/<feature-name> then ci builds a preview site
6966
build_preview:
7067
<<: *base_template
7168
stage: build
7269
cache:
73-
<<: *cache
74-
policy: pull
70+
- *yarn_cache_pull_push
7571
environment: "preview"
7672
variables:
7773
URL: ${PREVIEW_DOMAIN}
@@ -81,6 +77,7 @@ build_preview:
8177
LOCAL: "False"
8278
script:
8379
- post_dd_event "documentation deploy ${CI_COMMIT_REF_NAME} started" "${CI_PROJECT_URL}/pipelines/${CI_PIPELINE_ID}" "info"
80+
- yarn install --immutable
8481
- touch Makefile.config
8582
- make BRANCH=${CI_COMMIT_REF_NAME} examples
8683
- sync_integration_descriptions
@@ -156,11 +153,11 @@ index_algolia_preview:
156153
tags: ["runner:main"]
157154
stage: post-deploy
158155
cache:
159-
<<: *cache
160-
policy: pull
156+
- *yarn_cache
161157
environment: "preview"
162158
timeout: 1h 30m
163159
script:
160+
- yarn install --immutable
164161
- |-
165162
echo APPLICATION_ID=$(get_secret 'ci.documentation.algolia_preview_application_id') > .env
166163
echo API_KEY=$(get_secret 'ci.documentation.algolia_preview_api_key') >> .env
@@ -178,10 +175,10 @@ replica_algolia_preview:
178175
<<: *base_template
179176
stage: post-deploy
180177
cache:
181-
<<: *cache
182-
policy: pull
178+
- *yarn_cache
183179
environment: "preview"
184180
script:
181+
- yarn install --immutable
185182
- ALGOLIA_APP_ID=$(get_secret 'algolia_preview_application_id') ALGOLIA_ADMIN_KEY=$(get_secret 'algolia_preview_api_key') yarn run algolia:config
186183
dependencies:
187184
- build_preview
@@ -194,10 +191,10 @@ sourcemaps_preview:
194191
<<: *base_template
195192
stage: post-deploy
196193
cache:
197-
<<: *cache
198-
policy: pull
194+
- *yarn_cache
199195
environment: "preview"
200196
script:
197+
- yarn install --immutable
201198
# Rename any js.map files to include SHA if correlating JS file is fingerprinted. Hugo's asset build system seems to lose the fingerprint value when generating source maps.
202199
- find ./public -type f -name "*.*.js" -exec bash -c 'x={}; hash=$(basename $x | cut -d '.' -f 2); map=${x/$hash./}.map; mv $map ${map/.js/.$hash.js}' \;
203200
- DATADOG_API_KEY="$(get_secret 'dd-api-key')" ./node_modules/.bin/datadog-ci sourcemaps upload ./public/static --service docs --minified-path-prefix "https://docs-staging.datadoghq.com/${CI_COMMIT_REF_NAME}/static/" --release-version "${CI_COMMIT_SHORT_SHA}"
@@ -213,8 +210,7 @@ build_live:
213210
<<: *base_template
214211
stage: build
215212
cache:
216-
<<: *cache
217-
policy: pull
213+
- *yarn_cache_pull_push
218214
environment: "live"
219215
variables:
220216
CONFIG: ${LIVE_CONFIG}
@@ -225,6 +221,7 @@ build_live:
225221
script:
226222
- post_dd_event "documentation deploy ${CI_COMMIT_REF_NAME} started" "${CI_PROJECT_URL}/pipelines/${CI_PIPELINE_ID}" "info"
227223
- notify_slack "<https://github.com/DataDog/documentation/commit/${CI_COMMIT_SHA}|${CI_COMMIT_SHA:0:8}> sent to gitlab for production deployment. <${CI_PROJECT_URL}/pipelines/${CI_PIPELINE_ID}|details>" "#FFD700"
224+
- yarn install --immutable
228225
- touch Makefile.config
229226
- make clean-examples
230227
- make examples
@@ -295,11 +292,11 @@ index_algolia:
295292
tags: ["runner:main"]
296293
stage: post-deploy
297294
cache:
298-
<<: *cache
299-
policy: pull
295+
- *yarn_cache
300296
environment: "live"
301297
timeout: 1h 30m
302298
script:
299+
- yarn install --immutable
303300
- |-
304301
echo APPLICATION_ID=$(get_secret 'ci.documentation.algolia_docsearch_application_id') > .env
305302
echo API_KEY=$(get_secret 'ci.documentation.algolia_docsearch_api_key') >> .env
@@ -315,10 +312,10 @@ replica_algolia:
315312
<<: *base_template
316313
stage: post-deploy
317314
cache:
318-
<<: *cache
319-
policy: pull
315+
- *yarn_cache
320316
environment: "live"
321317
script:
318+
- yarn install --immutable
322319
- ALGOLIA_APP_ID=$(get_secret 'algolia_docsearch_application_id') ALGOLIA_ADMIN_KEY=$(get_secret 'algolia_docsearch_api_key') yarn run algolia:config
323320
dependencies:
324321
- build_live
@@ -329,10 +326,10 @@ sourcemaps_live:
329326
<<: *base_template
330327
stage: post-deploy
331328
cache:
332-
<<: *cache
333-
policy: pull
329+
- *yarn_cache
334330
environment: "live"
335331
script:
332+
- yarn install --immutable
336333
# Rename any js.map files to include SHA if correlating JS file is fingerprinted. Hugo's asset build system seems to lose the fingerprint value when generating source maps.
337334
- find ./public -type f -name "*.*.js" -exec bash -c 'x={}; hash=$(basename $x | cut -d '.' -f 2); map=${x/$hash./}.map; mv $map ${map/.js/.$hash.js}' \;
338335
- DATADOG_API_KEY="$(get_secret 'dd-api-key')" ./node_modules/.bin/datadog-ci sourcemaps upload ./public/static --service docs --minified-path-prefix "https://docs.datadoghq.com/static/" --release-version "${CI_COMMIT_SHORT_SHA}"
@@ -412,12 +409,12 @@ test_pa11y:
412409
<<: *base_template
413410
stage: post-deploy
414411
cache:
415-
<<: *cache
416-
policy: pull
412+
- *yarn_cache
417413
environment: "live"
418414
dependencies:
419415
- build_live
420416
script:
417+
- yarn install --immutable
421418
- node ./local/bin/js/pa11y.js --env live --dd_api_key $(get_secret 'dd-api-key')
422419
only:
423420
- schedules

.yarn/releases/yarn-3.2.1.cjs

Lines changed: 786 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nodeLinker: node-modules
2+
yarnPath: .yarn/releases/yarn-3.2.1.cjs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Built with [hugo][1], a static website generation tool.
66

77
### Installation
88

9-
1. [Install node / npm][2]
9+
1. [Install node / npm][2] (node `>=14.16.0`)
1010

1111
2. [Install Python3][3] (you can also use [pyenv][4])
1212

local/bin/sh/run-site-no-pre-build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ if [ ${RUN_SERVER} = true ]; then
77
# Building the documentation
88
printf "checking that node modules are installed and up-to-date"
99
npm --global install yarn && \
10-
npm cache clean --force && yarn install --frozen-lockfile
10+
npm cache clean --force && yarn install --immutable
1111
printf "starting webpack and hugo build"
12+
yarn run prestart
1213
yarn run start
1314

1415
sleep 5

local/bin/sh/run-site.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if [ ${RUN_SERVER} = true ]; then
1818

1919
update_pre_build.py "${args}"
2020

21-
# rbac permissions
21+
# rbac permissions
2222
if [ ${PULL_RBAC_PERMISSIONS} == true ]; then
2323
echo "Pulling RBAC permissions."
2424

@@ -37,8 +37,9 @@ if [ ${RUN_SERVER} = true ]; then
3737

3838
echo "Checking that node modules are installed and up-to-date."
3939
npm --global install yarn && \
40-
npm cache clean --force && yarn install --frozen-lockfile
40+
npm cache clean --force && yarn install --immutable
4141
echo "Starting webpack and hugo build."
42+
yarn run prestart
4243
yarn run start
4344

4445
sleep 5

package.json

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
"algolia:config": "node ./local/bin/js/algolia-config.js",
88
"preinstall": "bash local/bin/sh/preinstall.sh",
99
"prestart": "rimraf public && npx hugo mod clean",
10-
"start": "run-p start:**",
11-
"start:hugo": "./node_modules/.bin/hugo server -D -d ./public -s ./ --port 1313 --navigateToChanged --noHTTPCache",
10+
"start": "./node_modules/.bin/hugo server -D -d ./public -s ./ --port 1313 --navigateToChanged --noHTTPCache",
1211
"prebuild": "rimraf public && npx hugo mod clean",
13-
"build": "run-s build:hugo",
12+
"build": "yarn run prebuild && yarn run build:hugo",
1413
"build:preview": "yarn run build:hugo:preview",
1514
"build:hugo": "./node_modules/.bin/hugo -d ./public -s ./ -v --minify",
16-
"build:hugo:preview": "yarn run build:hugo -- -D -F --environment preview",
17-
"build:hugo:live": "yarn run build:hugo -- -D -F --environment live",
18-
"build:live": "run-s build:hugo:live",
15+
"build:hugo:preview": "yarn run build:hugo -D -F --environment preview",
16+
"build:hugo:live": "yarn run build:hugo -D -F --environment live",
17+
"build:live": "yarn run build:hugo:live",
1918
"deploy:previewAssets": "./node_modules/.bin/hugo deploy --target previewAssets -e preview --maxDeletes 0 --log --verbose",
2019
"deploy:preview": "./node_modules/.bin/hugo deploy --target preview -e preview --maxDeletes -1 --invalidateCDN --log --verbose",
2120
"deploy:liveAssets": "./node_modules/.bin/hugo deploy --target liveAssets -e live --maxDeletes 0 --log --verbose --debug",
@@ -40,8 +39,8 @@
4039
"dependencies": {
4140
"@apidevtools/json-schema-ref-parser": "^8.0.0",
4241
"@babel/polyfill": "^7.4.4",
43-
"@datadog/browser-logs": "^3.6.4",
44-
"@datadog/browser-rum": "^3.6.4",
42+
"@datadog/browser-logs": "^4.11.2",
43+
"@datadog/browser-rum": "^4.11.2",
4544
"a11y": "https://s3.amazonaws.com/origin-static-assets/corp-node-packages/master/a11y-v1.0.1.tgz",
4645
"algoliasearch": "4.11.0",
4746
"bootstrap": "4.3.1",
@@ -79,31 +78,24 @@
7978
"eslint-config-airbnb": "^18.1.0",
8079
"eslint-config-prettier": "^6.10.1",
8180
"eslint-config-standard": "^14.1.1",
82-
"eslint-loader": "^3.0.2",
8381
"eslint-plugin-import": "^2.20.1",
8482
"eslint-plugin-jsx-a11y": "^6.2.3",
8583
"eslint-plugin-node": "^9.1.0",
8684
"eslint-plugin-promise": "^4.2.1",
8785
"eslint-plugin-react": "^7.19.0",
8886
"eslint-plugin-react-hooks": "^2.5.0",
8987
"eslint-plugin-standard": "^4.0.0",
90-
"exports-loader": "^0.7.0",
91-
"expose-loader": "^0.7.5",
92-
"file-loader": "^4.1.0",
93-
"html-loader": "^0.5.5",
94-
"imports-loader": "^0.8.0",
9588
"jest": "^25.3.0",
96-
"npm-run-all": "^4.1.5",
9789
"postcss-import": "^12.0.1",
9890
"postcss-preset-env": "^6.7.0",
9991
"prettier": "^2.0.2",
100-
"resolve-url-loader": "^3.1.0",
10192
"rimraf": "^3.0.2",
10293
"run-sequence": "^2.2.1",
10394
"sass": "^1.26.10",
10495
"serialize-javascript": "^2.1.1"
10596
},
10697
"hugo-bin": {
10798
"buildTags": "extended"
108-
}
99+
},
100+
"packageManager": "yarn@3.2.1"
109101
}

0 commit comments

Comments
 (0)