Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Migrate docs to MDX #2010

Merged
merged 11 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
175 changes: 16 additions & 159 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,169 +1,26 @@
version: 2.1

orbs:
# Slack orb v. 3 uses a webhook URL for auth. If upgrading to v. 4+, we'll need a token instead.
slack: circleci/slack@3.4.2

references:
images:
middleman: &MIDDLEMAN_IMAGE docker.mirror.hashicorp.services/hashicorp/middleman-hashicorp:0.3.47
ubuntu: &UBUNTU_IMAGE ubuntu-1604:201903-01
# We rely on dart-lang/sdk commit 7e7c01e804179782f884b174706ed0c80fb2ef71
# -- earliest viable container version is 2.11.0-182.0.dev
dart: &DART docker.mirror.hashicorp.services/google/dart:2.12.0-133.2.beta

cache:
rubygem: &RUBYGEM_CACHE_KEY static-site-gems-v1-{{ checksum "content/Gemfile.lock" }}
version: 2

jobs:
website-link-check:
algolia-index:
docker:
- image: *MIDDLEMAN_IMAGE
- image: node:14
steps:
- checkout

- run: make sync

# restores gem cache
- restore_cache:
key: *RUBYGEM_CACHE_KEY

- run:
name: install gems
working_directory: content
command: bundle check || bundle install --path vendor/bundle --retry=3

# saves gem cache if we have changed the Gemfile
- save_cache:
key: *RUBYGEM_CACHE_KEY
paths:
- content/vendor/bundle

- run:
name: run middleman in background
working_directory: content
background: true
command: bundle exec middleman server

- run:
name: wait for server to start
command: until curl -sS http://localhost:4567/ > /dev/null; do sleep 1; done

- run:
name: check links in changed pages
working_directory: content
command:
git diff --name-only -z --diff-filter=AMRCT $(git merge-base HEAD origin/master)..HEAD | bundle exec ./scripts/check-pr-links.rb
# --name-only: Return a list of affected files but don't show the changes.
# -z: Make that a null-separated list (instead of newline-separated), and
# DON'T mangle non-ASCII characters.
# --diff-filter=AMRCT: Only list files that were added, modified, renamed,
# copied, or had their type changed (file, symlink, etc.). In
# particular, we don't want to check deleted files.
# $(git merge-base HEAD origin/master)..HEAD: Only consider files that have
# changed since this branch diverged from master.

website-build-and-upload:
docker:
- image: *MIDDLEMAN_IMAGE
steps:
- slack/notify:
message: ":terraform-loading: Starting build/deploy for terraform.io..."
color: "#ECB942"

- checkout

# pull and update git submodules
- run: make sync

# restores gem cache
- restore_cache:
key: *RUBYGEM_CACHE_KEY

- run:
name: install gems
working_directory: content
command: bundle check || bundle install --path vendor/bundle --retry=3

# saves gem cache if we have changed the Gemfile
- save_cache:
key: *RUBYGEM_CACHE_KEY
paths:
- content/vendor/bundle

- run:
name: middleman build
working_directory: content
command: bundle exec middleman build

- run:
working_directory: content
command: ./scripts/upload.sh

- slack/status:
success_message: ":terraformda: Successfully deployed to terraform.io."
failure_message: ":boom: Failed to deploy terraform.io! Urgent attention needed! <!here>"

website-warm-cache-check-links:
docker:
- image: *DART
steps:
# TODO: This should be in the container, but we want to get the kinks
# worked out before committing to the overhead. Also the install takes 3s.
- run:
name: install filiph/linkcheck
command: pub global activate linkcheck

- run:
name: Warm cache and check for broken links
command: /root/.pub-cache/bin/linkcheck https://www.terraform.io/docs

- slack/status:
success_message: ":white_check_mark: Finished warming cache for terraform.io. :meow_yay: No broken links!"
failure_message: ":broken_image: Found broken links while warming cache for terraform.io. For details, check job log."

website-check-incoming-links:
docker:
- image: *MIDDLEMAN_IMAGE
steps:
- checkout

# Don't need to set up gems, submodules, or anything like that. We just
# need the script and the data files.

- run: ./content/scripts/check-incoming-links.sh https://www.terraform.io

- slack/status:
success_message: ":white_check_mark: WEEKLY INCOMING LINKS CHECK: :meow_yay: No broken links!"
failure_message: ":broken_image: WEEKLY INCOMING LINKS CHECK: An important page was deleted without getting a redirect! :fire_on_fire: Please check the job log and make sure that page gets redirected."

name: Push content to Algolia Index
command: |
if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/terraform-website.git" ]; then
echo "Not Terraform Website Repo, not indexing Algolia"
exit 0
fi
npm ci
node scripts/index_search_content.js
workflows:
website-test:
# run on branches and PRs; ignore master, since the cache warming also checks links.
jobs:
- website-link-check:
filters:
branches:
ignore: master
website-deploy:
# only run on main branch
jobs:
- website-build-and-upload:
context: static-sites
filters:
branches:
only: master
- website-warm-cache-check-links:
context: static-sites
requires:
- website-build-and-upload
website-weekly-check:
version: 2
algolia_index:
jobs:
- website-check-incoming-links
triggers:
- schedule:
# ~11 am pacific time (19 UTC), every monday
cron: "0 19 * * 1"
- algolia-index:
filters:
branches:
only: master
only:
- master
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab

[{*.md,*.json}]
max_line_length = null

[*.mdx]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NEXT_PUBLIC_ALGOLIA_APP_ID=YY0FFNI7MF
NEXT_PUBLIC_ALGOLIA_INDEX=product_TERRAFORM
NEXT_PUBLIC_ALGOLIA_SEARCH_ONLY_API_KEY=49e670100103ee846816a4b1a577004e
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
...require('@hashicorp/platform-cli/config/.eslintrc.js'),
ignorePatterns: ['public/'],
}
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
content/cdktf symlink=dir
content/cli symlink=dir
content/configuration symlink=dir
content/guides symlink=dir
content/internals symlink=dir
content/intro symlink=dir
content/language symlink=dir
2 changes: 0 additions & 2 deletions .github/CODEOWNERS

This file was deleted.

17 changes: 0 additions & 17 deletions .github/pull_request_template.md

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Cypress Tests

on: [deployment_status]

jobs:
cypress-percy:
# Sender id is Vercel's
if: github.event.deployment_status.state == 'success' && github.event.sender.id == 35613825
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3]
steps:
- name: Checkout 🛎
uses: actions/checkout@v1
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '14'
# Get the branch name from the commit SHA
- name: Set branch name
run: echo "BRANCH=$(git name-rev --name-only $GITHUB_SHA | awk -F / '{print $3}')" >> $GITHUB_ENV
- name: Run Cypress 🌲
uses: cypress-io/github-action@v2
with:
browser: chrome
headless: true
record: true
parallel: true
group: 'GitHub Actions'
command-prefix: 'percy exec -t 500 -- npx'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Pass the Vercel reported environment (Preview or Production) through to Cypress
# This is used for conditional tests: enterpriseTrials.spec.js and salesFormPage.spec.js
CYPRESS_DEPLOY_ENVIRONMENT: ${{ github.event.deployment.environment }}
# We pass the gh token to allow Cypress to detect re-runs accurately.
# See https://github.com/cypress-io/github-action
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
CYPRESS_BASE_URL: ${{ github.event.deployment_status.target_url }}
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_TARGET_BRANCH: 'master'
# Use the branch name set in the 'Set branch name' job above
PERCY_BRANCH: ${{ env.BRANCH }}
COMMIT_INFO_BRANCH: ${{ env.BRANCH }}
# Should match the total in matrix:containers
PERCY_PARALLEL_TOTAL: 3
PERCY_PARALLEL_NONCE: '${{ github.event_name }}-${{ github.sha }}'
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.vagrant
.bundle
build
node_modules
vendor
.idea*
*.DS_Store
.vscode/
.DS_Store
.next
out
.mdx-data

# As per Next.js conventions (https://nextjs.org/docs/basic-features/environment-variables#default-environment-variables)
!.env
.env*.local
6 changes: 2 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[submodule "ext/terraform"]
path = ext/terraform
url = https://github.com/hashicorp/terraform.git
branch = stable-website
url = https://github.com/hashicorp/terraform
[submodule "ext/terraform-cdk"]
path = ext/terraform-cdk
url = https://github.com/hashicorp/terraform-cdk.git
branch = stable-website
url = https://github.com/hashicorp/terraform-cdk
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

4 changes: 4 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
...require('@hashicorp/platform-cli/config/stylelint.config'),
/* Specify overrides here */
}
1 change: 0 additions & 1 deletion Gemfile

This file was deleted.

Loading