Skip to content

Commit 1803d58

Browse files
committed
Update docs
1 parent 1f13170 commit 1803d58

File tree

1 file changed

+32
-21
lines changed

1 file changed

+32
-21
lines changed

README.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ First we need to create 5 new GitHub Repository Secrets (encrypted variables) in
7777

7878
We should start to create a new Pulumi Access Token `PULUMI_ACCESS_TOKEN` at https://app.pulumi.com/jonashackt/settings/tokens
7979

80-
Now we need to create the Azure specific variables (see the docs https://github.com/pulumi/actions#microsoft-azure):
80+
Now we need to create the Azure specific variables (see the docs https://github.com/pulumi/actions#microsoft-azure).
8181

82-
`ARM_SUBSCRIPTION_ID`
82+
For the `ARM_SUBSCRIPTION_ID` run a `az account show` (after you logged your CLI into your Azure subscription via `azure login`) and use the value of `"id":`.
8383

8484
For the other 3 variables we need to create a new Azure Service Principal (https://www.pulumi.com/docs/intro/cloud-providers/azure/setup/#creating-a-service-principal), which [is the recommended way](https://www.pulumi.com/docs/intro/cloud-providers/azure/setup/#service-principal-authentication):
8585

@@ -115,38 +115,48 @@ env:
115115
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
116116

117117
jobs:
118-
preview:
118+
preview-up-destroy:
119119
runs-on: ubuntu-latest
120120
steps:
121121
- uses: actions/checkout@v2
122122

123-
- uses: pulumi/actions@v2
123+
- name: In order to use the Pulumi v2+ action, we need to setup the Pulumi project specific language environment
124+
uses: actions/setup-node@v2
124125
with:
125-
command: preview
126-
stack-name: github-$GITHUB_RUN_ID
126+
node-version: '14'
127127

128-
up:
129-
runs-on: ubuntu-latest
130-
needs: preview
131-
steps:
132-
- uses: actions/checkout@v2
128+
- name: After setting up the Pulumi project specific language environment, we need to install the dependencies also (see https://github.com/pulumi/actions#example-workflows)
129+
run: npm install
133130

134-
- uses: pulumi/actions@v2
131+
- name: Install Pulumi CLI so that we can create a GHA pipeline specific Pulumi Stack
132+
uses: pulumi/[email protected]
133+
134+
- name: Create GHA pipeline specific Pulumi Stack incl. Azure location
135+
run: |
136+
pulumi stack init github-${{ github.run_id }}
137+
pulumi config set azure:location WestEurope
138+
139+
- name: Preview pulumi up
140+
uses: pulumi/actions@v3
135141
with:
136-
command: up
137-
stack-name: github-$GITHUB_RUN_ID
142+
command: preview
143+
stack-name: github-${{ github.run_id }}
138144

139-
destroy:
140-
runs-on: ubuntu-latest
141-
needs: up
142-
steps:
143-
- uses: actions/checkout@v2
145+
- name: Actually run pulumi up
146+
uses: pulumi/actions@v3
147+
with:
148+
command: up
149+
stack-name: github-${{ github.run_id }}
144150

145-
- uses: pulumi/actions@v2
151+
- name: Destroy resources via pulumi destroy
152+
uses: pulumi/actions@v3
146153
with:
147154
command: destroy
148-
stack-name: github-$GITHUB_RUN_ID
155+
stack-name: github-${{ github.run_id }}
149156

157+
- name: Remove the GHA pipeline specific Pulumi Stack
158+
run: |
159+
pulumi stack rm github-${{ github.run_id }} -y
150160
```
151161
152162
We use the possibility [to define the environment variables on the workflow's top level](https://docs.github.com/en/actions/reference/environment-variables) to reduce the 3 definition to one. Also we define a `stack-name` containing the `GITHUB_RUN_ID` which is one of [the default GHA environment variables](https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables) which is defined as:
@@ -163,6 +173,7 @@ To learn more about possible reasons and resolution, visit https://www.pulumi.co
163173
164174
```
165175

176+
See this https://stackoverflow.com/questions/66563656/pulumi-with-github-actions-crashing-parallel-workflows-with-error-409-conflic/66563657#66563657
166177

167178
Using this simply workflow, the first `preview` job needs to finish successfully before the `up` job starts:
168179

0 commit comments

Comments
 (0)