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

Commit

Permalink
Merge branch 'master' into sean/mobile-design
Browse files Browse the repository at this point in the history
* master: (24 commits)
  Add the helper method for C# (#1567)
  Update install-java.html (#1563)
  fix typo in from_terraform.md (#1564)
  Add replacement property icon for Registry api docs. (#1565)
  Update go.mod
  Add GitLab OAuth vars to api.md for Pulumi Service self-hosted documentation (#1555)
  Prettier Spike (#1517)
  Update go.mod
  fix 404 in aiven blog (#1562)
  Update go.mod
  fix broken sans institute link (#1560)
  Update go.mod
  Ensure camelCase warning is above nested property excamples for IgnoreChanges (#1557)
  Fix webiny blog broken links (#1559)
  Fix relative link to auto-naming in intro (#1549)
  self-hosted: Document FunctionMode env vars (#1505)
  Update go.mod
  Add helper text to blog post archetype (#1502)
  Update go.mod
  Hide right hand cta (#1558)
  ...
  • Loading branch information
sean1588 committed Jun 2, 2022
2 parents 1f325b5 + 7e2aed6 commit 9706e0c
Show file tree
Hide file tree
Showing 271 changed files with 9,546 additions and 5,766 deletions.
24 changes: 12 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.202.3/containers/hugo
{
"name": "Hugo",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "hugo",
"VERSION": "0.96.0",
"NODE_VERSION": "16",
"GO_VERSION": "1.16.9"
}
},
"name": "Hugo",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "hugo",
"VERSION": "0.96.0",
"NODE_VERSION": "16",
"GO_VERSION": "1.16.9"
}
},

"forwardPorts": [1313],
"forwardPorts": [1313],

"remoteUser": "node"
"remoteUser": "node"
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.yml, *.yaml]
indent_size = 2

2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Bulk Prettier changes
d6efb2f19a7767768378a574e078f86d44f2cc2c
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: "16.x"

- name: Install Go
uses: actions/setup-go@v2
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Install Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.96.0'
hugo-version: "0.96.0"
extended: true

- name: Check out branch
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: "16.x"

- name: Install Go
uses: actions/setup-go@v2
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Install Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.96.0'
hugo-version: "0.96.0"
extended: true

- name: Check out branch
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/scheduled-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: "16.x"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -28,6 +28,6 @@ jobs:
- name: Find and remove buckets
run: make ci-scheduled
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
SLACK_ACCESS_TOKEN: ${{ secrets.SLACK_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
SLACK_ACCESS_TOKEN: ${{ secrets.SLACK_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 22 additions & 22 deletions .github/workflows/scheduled-upstream-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Scheduled Jobs: Upstream Sync"

on:
schedule:
- cron: 0/15 * * * *
- cron: 0/15 * * * *
workflow_dispatch:

jobs:
Expand All @@ -13,28 +13,28 @@ jobs:
name: Sync latest commits from upstream repo

steps:
- name: Checkout target repo
uses: actions/checkout@v2
with:
ref: master
token: ${{ secrets.PULUMI_BOT_TOKEN }}
- name: Checkout target repo
uses: actions/checkout@v2
with:
ref: master
token: ${{ secrets.PULUMI_BOT_TOKEN }}

- name: Sync upstream changes
id: sync
uses: aormsby/Fork-Sync-With-Upstream-action@v3.2
with:
upstream_sync_repo: pulumi/pulumi-hugo
upstream_sync_branch: master
target_sync_branch: master
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: Sync upstream changes
id: sync
uses: aormsby/Fork-Sync-With-Upstream-action@v3.2
with:
upstream_sync_repo: pulumi/pulumi-hugo
upstream_sync_branch: master
target_sync_branch: master
target_repo_token: ${{ secrets.GITHUB_TOKEN }}

- name: New commits found
if: steps.sync.outputs.has_new_commits == 'true'
run: echo "New commits were found to sync."
- name: New commits found
if: steps.sync.outputs.has_new_commits == 'true'
run: echo "New commits were found to sync."

- name: No new commits
if: steps.sync.outputs.has_new_commits == 'false'
run: echo "There were no new commits."
- name: No new commits
if: steps.sync.outputs.has_new_commits == 'false'
run: echo "There were no new commits."

- name: Show value of 'has_new_commits'
run: echo ${{ steps.sync.outputs.has_new_commits }}
- name: Show value of 'has_new_commits'
run: echo ${{ steps.sync.outputs.has_new_commits }}
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
_vendor
node_modules
/resources
themes/*/resources
public
.idea
.vscode
.DS_Store
yarn-error.log
.hugo_build.lock
*.md
26 changes: 26 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"jsxSingleQuote": false,
"quoteProps": "consistent",
"printWidth": 180,
"semi": true,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "all",
"useTabs": false,
"overrides": [
{
"files": ["*.html"],
"options": {
"parser": "go-template"
}
},
{
"files": ["*.yml", "*.yaml"],
"options": {
"tabWidth": 2
}
}
]
}
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ ensure:
lint:
./scripts/lint.sh

.PHONY: format
format:
yarn prettier --write .

.PHONY: build
build:
./scripts/build.sh
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@ make serve

You can browse the development server at http://localhost:1313, and any changes you make to content or layouts should be reloaded automatically.

## Linting and testing
## Linting and formatting

To check your code and your Markdown files for issues before submitting, run:

```
make lint
```

This repo uses Prettier for code formatting, to keep styling + formatting issues aligned without the need to be reviewed in PRs. To see what files have formatting diffs, you can run `make format` from the project root, which will update all files to conform to our formatting standards. To check the diffs without fixing them, a check runs as part of `make lint`.

Prettier is easiest to use when you run it automatically on save in your editor - see the docs here: https://prettier.io/docs/en/editors.html. If you set your editor to format on save, you should be staying aligned with formatting without needing to run any of the above commands.

## Tidying up

To clear away any module caches or build artifacts, run:
Expand Down
16 changes: 8 additions & 8 deletions config/_default/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ markup:
xhtml: false

params:
canonicalURL: https://www.pulumi.com
contentRepositoryURL: https://github.com/pulumi/pulumi-hugo
contentRepositoryBaseBranch: master
registryRepositoryURL: https://github.com/pulumi/registry
registryRepositoryBaseBranch: master
meta_desc: |
Pulumi's open source infrastructure as code SDK enables you to create, deploy,
and manage infrastructure on any cloud, using your favorite languages.
canonicalURL: https://www.pulumi.com
contentRepositoryURL: https://github.com/pulumi/pulumi-hugo
contentRepositoryBaseBranch: master
registryRepositoryURL: https://github.com/pulumi/registry
registryRepositoryBaseBranch: master
meta_desc: |
Pulumi's open source infrastructure as code SDK enables you to create, deploy,
and manage infrastructure on any cloud, using your favorite languages.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"concurrently": "^6.0.0",
"js-yaml": "^3.13.1",
"markdownlint": "^0.17.2",
"sass":"^1.39.2"
"sass": "^1.39.2"
},
"devDependencies": {
"prettier": "^2.6.2",
"prettier-plugin-go-template": "^0.0.13"
}
}
1 change: 1 addition & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash

node ./scripts/lint/lint-markdown.js
yarn prettier --check .
30 changes: 17 additions & 13 deletions scripts/lint/lint-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function checkPageTitle(title) {
return "Page title exceeds 60 characters";
}
} else {
return "Page title is not a valid string"
return "Page title is not a valid string";
}
return null;
}
Expand Down Expand Up @@ -74,7 +74,7 @@ function searchForMarkdown(paths, result) {
result = {
files: [],
frontMatter: {},
}
};
}
// Grab the first file in the list and generate
// its full path.
Expand Down Expand Up @@ -162,7 +162,7 @@ function searchForMarkdown(paths, result) {
* @param {string} parentPath The path to search for markdown files
*/
function getMarkdownFiles(parentPath) {
const fullParentPath = path.resolve(__dirname, parentPath)
const fullParentPath = path.resolve(__dirname, parentPath);
const dirs = fs.readdirSync(fullParentPath).map(function (dir) {
return path.join(parentPath, dir);
});
Expand Down Expand Up @@ -274,19 +274,23 @@ const result = markdownlint.sync(opts);
const errors = groupLintErrorOutput(result);

// Get the total number of errors.
const errorsArray = errors.map(function (err) { return err.errors });
const errorsArray = errors.map(function (err) {
return err.errors;
});
const errorsCount = [].concat.apply([], errorsArray).length;

// Create the error output string.
const errorOutput = errors.map(function (err) {
let msg = err.path + ":\n";
for (let i = 0; i < err.errors.length; i++) {
const error = err.errors[i];
msg += "Line " + error.lineNumber + ": " + error.ruleDescription;
msg += error.errorDetail ? " [" + error.errorDetail + "].\n" : ".\n";
}
return msg;
}).join("\n");
const errorOutput = errors
.map(function (err) {
let msg = err.path + ":\n";
for (let i = 0; i < err.errors.length; i++) {
const error = err.errors[i];
msg += "Line " + error.lineNumber + ": " + error.ruleDescription;
msg += error.errorDetail ? " [" + error.errorDetail + "].\n" : ".\n";
}
return msg;
})
.join("\n");

// If there are errors output the error string and exit
// the program with an error.
Expand Down
3 changes: 2 additions & 1 deletion themes/default/archetypes/blog-post/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ date: {{ .Date }}

# Use the meta_desc property to provide a brief summary (one or two sentences)
# of the content of the post, which is useful for targeting search results or social-media
# previews. This field is required or the build will fail the linter test.
# previews. This field is required or the build will fail the linter test.
# Max length is 160 characters.
meta_desc:

# The meta_image appears in social-media previews and on the blog home page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ As we can see, every project application follows the same general organization.

Furthermore, if we opened each of these `pulumi` folders, we’d see different cloud infrastructure resources clearly defined via multiple TypeScript classes. As a simple example, if we were to open the [`apps/admin/pulumi`](https://github.com/webiny/webiny-js/tree/next/packages/cwp-template-aws/template/common/apps/admin/pulumi) (Admin Area) folder, we’d find the following three files:

- [`app.ts`](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/apps/admin/pulumi/app.ts) - deploys an [Amazon S3](https://aws.amazon.com/s3/) bucket that hosts the Admin Area (React) application
- [`cloudfront.ts`](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/apps/admin/pulumi/cloudfront.ts) - deploys an [Amazon CloudFront](https://aws.amazon.com/cloudfront/) distribution for improved availability
- [`index.ts`](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/apps/admin/pulumi/index.ts) - the Pulumi entrypoint file, imports classes defined within separate files
- [`app.ts`](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/common/apps/admin/pulumi/app.ts) - deploys an [Amazon S3](https://aws.amazon.com/s3/) bucket that hosts the Admin Area (React) application
- [`cloudfront.ts`](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/common/apps/admin/pulumi/cloudfront.ts) - deploys an [Amazon CloudFront](https://aws.amazon.com/cloudfront/) distribution for improved availability
- [`index.ts`](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/common/apps/admin/pulumi/index.ts) - the Pulumi entrypoint file, imports classes defined within separate files

This code organization makes it much easier for developers to grasp the overall cloud infrastructure. It also makes it easier for them to adjust the code to their needs eventually.

Expand All @@ -210,7 +210,7 @@ These extra resources make it slower to perform deployments from developers' mac

So, with that in mind, we split the API project application’s cloud infrastructure into two stacks - the `dev` and `prod`. And, as you might’ve already guessed, only the `prod` variant will deploy absolutely all necessary cloud infrastructure resources.

What is even more interesting is the fact that this can be achieved with a simple if statement, which we placed in the [`index.ts`](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/api/pulumi/index.ts#L10-L16) entrypoint file:
What is even more interesting is the fact that this can be achieved with a simple if statement, which we placed in the [`index.ts`](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/ddb-es/api/pulumi/index.ts#L19-L25) entrypoint file:

```typescript
// (...)
Expand All @@ -237,7 +237,7 @@ Another useful feature is the automatic tagging of the deployed cloud infrastruc

We created a `tagResources` function, which essentially registers a global stack transformation via [`pulumi.runtime.registerStackTransformation`](https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/runtime/#registerStackTransformation) function to achieve this.

It is also applied in the same [`index.ts`](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/api/pulumi/index.ts#L4-L8) entrypoint file we saw in the previous section:
It is also applied in the same [`index.ts`](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/common/apps/admin/pulumi/index.ts#L6-L11) entrypoint file we saw in the previous section:

```typescript
import { tagResources } from "@webiny/cli-plugin-deploy-pulumi/utils";
Expand All @@ -259,7 +259,7 @@ Finally, to protect our users from accidental deletions of mission-critical clou

> The protect option marks a resource as protected. A protected resource cannot be deleted directly. Instead, you must first set `protect: false` and run `pulumi up`. Then you can delete the resource by removing the line of code or by running `pulumi destroy`. The default is to inherit this value from the parent resource and `false` for resources without a parent.
So, for Webiny users, we’ve made sure that this feature is automatically enabled for resources like [DynamoDB tables](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/api/pulumi/prod/dynamoDb.ts#L27), [Cognito User Pools](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/api/pulumi/prod/cognito.ts#L70), [Elasticsearch Cluster](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/api/pulumi/prod/elasticSearch.ts#L41), and similar.
So, for Webiny users, we’ve made sure that this feature is automatically enabled for resources like [DynamoDB tables](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/ddb/api/pulumi/prod/dynamoDb.ts#L27), [Cognito User Pools](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/ddb/api/pulumi/prod/cognito.ts#L70), [Elasticsearch Cluster](https://github.com/webiny/webiny-js/blob/next/packages/cwp-template-aws/template/ddb-es/api/pulumi/prod/elasticSearch.ts#L42), and similar.

## Future Plans

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ $ pulumi plugin install resource aiven 3.3.2
```

- To find out the current version numbers, go to
[Pulumi changelog](https://github.com/pulumi/pulumi-aws/blob/master/CHANGELOG.md) or [the Aiven changelog](https://github.com/pulumi/pulumi-aiven/blob/master/CHANGELOG.md).
[Pulumi changelog](https://github.com/pulumi/pulumi-aws/releases) or the [Aiven changelog](https://github.com/pulumi/pulumi-aiven/blob/master/CHANGELOG.md).

Set your preferred cloud regions and Aiven project name (these defaults are used in the setup script):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ Refer to the API documentation for these libraries for full details on configura

## Converting Terraform HCL to Pulumi

The [`tf2pulumi`](https://github.com/pulumi/tf2pulumi) tool can convert existing Terraform source code written in the HashiCorp Configuration Language (HCL) into Pulumi source code. In addition to converting source code, this tool also offers the option to [automatically insert import IDs]({{< relref "import" >}}), so that you can also import state during the conversion. This ensures live resources are brought under the control of Pulumi as well as letting you deploy and manage new copies of that inrastruture.
The [`tf2pulumi`](https://github.com/pulumi/tf2pulumi) tool can convert existing Terraform source code written in the HashiCorp Configuration Language (HCL) into Pulumi source code. In addition to converting source code, this tool also offers the option to [automatically insert import IDs]({{< relref "import" >}}), so that you can also import state during the conversion. This ensures live resources are brought under the control of Pulumi as well as letting you deploy and manage new copies of that infrastructure.

### How to Use the Tool

Expand Down
Loading

0 comments on commit 9706e0c

Please sign in to comment.