Skip to content

Commit f7622b9

Browse files
committed
Target v2 on guides
1 parent 0bfcd37 commit f7622b9

File tree

2 files changed

+49
-20
lines changed

2 files changed

+49
-20
lines changed

umbraco-cloud/set-up/project-settings/umbraco-cicd/samplecicdpipeline/azure-devops.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ If you add Build and Test stages after `cloudSyncStage` make sure that you check
210210

211211
### Cloud-sync
212212

213-
The `cloud-sync.yml` shows how you can sync your Azure DevOps repository with the left-most environment of your Cloud project. In this sample, it accepts any change from the API and applies and commits it back to the branch which triggered the pipeline. However the commit does not trigger the pipeline again.
213+
The `cloud-sync.yml` shows how you can sync your Azure DevOps repository with the targeted environment of your Cloud project. In this sample, it accepts any change from the API and applies and commits it back to the branch which triggered the pipeline. However the commit does not trigger the pipeline again.
214214

215215
If you don't want the pipeline to commit back to the triggering branch, this is where you need to change the pipeline.
216216

@@ -223,6 +223,8 @@ There are a couple of things here to be aware of:
223223
* The sample is overwriting the `.gitignore` file with `cloud.gitignore`. This is a way to accommodate your gitignore-needs when working locally. For instance you might want to ignore frontend builds, but you want them build and published to cloud.
224224
* The sample contains a special `cloud.zipignore` file. This is a convenient way to tell the pipeline which files **not** to include when creating the zip package to send to cloud.
225225

226+
If you want to customize the artifact take a look at [Artifact Best Practice](../ArtifactBestPractice.md).
227+
226228
### Cloud-deployment
227229

228230
The `cloud-deployment.yml` shows how you can deploy to a named environment of your Cloud project. The sample shows how to request the deployment and wait for cloud to finish the operation.

umbraco-cloud/set-up/project-settings/umbraco-cicd/samplecicdpipeline/github-actions.md

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ The Umbraco CI/CD Team has created a sample pipeline for Azure DevOps.
1818

1919
The Scripts are provided as is. This means that the scripts will do the bare minimum for a pipeline that is utilizing the CI/CD flow. 
2020

21-
You'll need to adapt and integrate the script to fit your pipelines to gain the ability to do deployments to your Umbraco Cloud projects.
21+
You'll need to adapt and integrate the script into your own pipelines to gain the ability to do deployments to your Umbraco Cloud projects.
2222

23-
The sample includes YAML files and custom Powershell and Bash scripts to interact with the Umbraco Cloud API.
23+
The sample includes YAML-files and custom Powershell and Bash scripts to interact with the Umbraco Cloud API.
2424

2525
You can get the samples for both `Azure DevOps` and `GitHub Actions` from the [GitHub repository](https://github.com/umbraco/Umbraco.Cloud.CICDFlow.Samples).
2626
{% endhint %}
@@ -62,6 +62,8 @@ Now we can move on to setting up a pipeline.
6262

6363
The pipeline needs to know which Umbraco Cloud project to deploy to. In order to do this you will need the `Project ID` and the `API Key`. [This article](./#obtaining-the-project-id-and-api-key) describes how to get those values.
6464

65+
You will also need the alias of the environment you want to target. [This article](./#getting-environment-aliases-to-target) described how you can see a list of environments you can target here. Note the environment alias you want to target.
66+
6567
* Now go to the repository in GitHub, and click on the Settings section.
6668
* Expand secrets and variables in the left-hand menu titled `Security` and click on `Actions`.
6769

@@ -70,8 +72,11 @@ The pipeline needs to know which Umbraco Cloud project to deploy to. In order to
7072
* Create a `repository secret` called `UMBRACO_CLOUD_API_KEY` with the `API Key` value from the Umbraco Portal.
7173
* Create another `repository secret` with the name `PROJECT_ID` and the `Project ID` value from the Umbraco Portal.
7274

75+
Now go to the **Variables** tab
76+
* Create a `repository variable` called `TARGET_ENVIRONMENT_ALIAS` and enter the environment alias you selected earlier.
77+
7378
{% hint style="info" %}
74-
If you want to use other names for the secrets, you need to rename the `secrets` variables in each of `main.yml`'s jobs.
79+
If you want to use other names for the secrets and variables, you need to rename the `secrets` and `with` variables in each of `main.yml`'s jobs.
7580

7681
```yaml
7782
jobs:
@@ -80,14 +85,24 @@ jobs:
8085
secrets:
8186
projectId: ${{ secrets.PROJECT_ID }} # change the part inside the curly braces
8287
umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} # change the part inside the curly braces
88+
with:
89+
targetEnvironmentAlias: ${{ vars.TARGET_ENVIRONMENT_ALIAS }} # change the part inside the curly braces
90+
91+
cloud-artifact:
92+
uses: ./.github/workflows/cloud-artifact.yml
93+
secrets:
94+
projectId: ${{ secrets.PROJECT_ID }} # change the part inside the curly braces
95+
umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} # change the part inside the curly braces
8396

8497
cloud-deployment:
8598
needs: cloud-sync
8699
uses: ./.github/workflows/cloud-deployment.yml
87100
secrets:
88101
projectId: ${{ secrets.PROJECT_ID }} # change the part inside the curly braces
89102
umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} # change the part inside the curly braces
90-
```
103+
with:
104+
targetEnvironmentAlias: ${{ vars.TARGET_ENVIRONMENT_ALIAS }} # change the part inside the curly braces
105+
```
91106
{% endhint %}
92107
93108
Now GitHub is set up with the needed information to be able to run a deployment back to Umbraco Cloud.
@@ -113,6 +128,8 @@ This is how you can grant these permissions:
113128
While working with the project on your local machine, follow these steps to prepare the pipeline, using the [samples from the repository](https://github.com/umbraco/Umbraco.Cloud.CICDFlow.Samples).
114129

115130
{% hint style="info" %}
131+
TODO fix links
132+
116133
Download the provided sample scripts as ZIP from the [GitHub repository](https://github.com/umbraco/Umbraco.Cloud.CICDFlow.Samples/tree/main). Click on "Code" and then choose "Download ZIP". Then unzip it and use those files for the next steps.
117134
{% endhint %}
118135

@@ -128,13 +145,13 @@ For a pipeline that uses Powershell scripts you will need the following files:
128145
* `Get-LatestDeployment.ps1`
129146
* `Get-ChangesById.ps1`
130147
* `Apply-Patch.ps1`
131-
* `New-Deployment.ps1`
132-
* `Add-DeploymentPackage.ps1`
148+
* `Add-DeploymentArtifact.ps1`
133149
* `Start-Deployment.ps1`
134150
* `Test-DeploymentStatus.ps1`
135151
* From the `powershell/github` folder
136152
* `main.yml`
137153
* `cloud-sync.yml`
154+
* `cloud-artifact.yml`
138155
* `cloud-deployment.yml`
139156

140157
**Do the following to prepare the pipeline:**
@@ -162,13 +179,13 @@ For a pipeline that uses Bash scripts you will need the following files:
162179
* `get_latest_deployment.sh`
163180
* `get_changes_by_id.sh`
164181
* `apply-patch.sh`
165-
* `create_deployment.sh`
166-
* `upload_package.sh`
182+
* `upload_artifact.sh`
167183
* `start_deployment.sh`
168184
* `get_deployment_status.sh`
169185
* From the `bash/github` folder
170186
* `main.yml`
171187
* `cloud-sync.yml`
188+
* `cloud-artifact.yml`
172189
* `cloud-deployment.yml`
173190

174191
**Do the following to prepare the pipeline:**
@@ -194,7 +211,7 @@ The push will start a new pipeline run.
194211

195212
With everything set up, you may want to confirm that Umbraco Cloud reflects the changes you are sending via your pipeline.
196213

197-
While working on you project locally, add a new Document type.
214+
While working on your project locally, add a new Document type.
198215

199216
* Commit the change to `main` branch (or `master` if you did not change the branch name) and push to your repository.
200217
* The pipeline starts to run
@@ -203,36 +220,46 @@ While working on you project locally, add a new Document type.
203220

204221
## High level overview of the pipeline components
205222

206-
The mentioned scripts are provided as a starting point. It is recommended that you familiarize yourself with the scripts and with documentation related to how to use GitHub Actions.
223+
The mentioned scripts are provided as a starting point.
224+
It is recommended that you familiarize yourself with the scripts and with documentation related to how to use GitHub Actions.
207225

208226
The scripts demonstrates the following:
209227

210-
* How to sync your GitHub repository with the [left-most project environment](../../../../deployment/) in Umbraco Cloud
211-
* How to deploy changes to the left-most project environment in Umbraco Cloud
228+
* How to sync your GitHub repository with an environment in Umbraco Cloud via the environment alias
229+
* How to prepare and upload an artifact that can be used for a deployment
230+
* How to deploy changes to an environment in Umbraco Cloud, targeted via the environment alias
212231

213232
### Main
214233

215234
The `main.yml` is the main pipeline, and is the one that will be triggered on a push to `main` branch. You can configure a different trigger behavior in this file.
216235

217-
You can add your Build and Test jobs between the `cloud-sync` and `cloud-deployment` jobs. Keep in mind that you do not need to retain the dotnet build artifact for upload later. The `cloud-deployment` job will take care of packaging all your source code and upload to Umbraco Cloud.
236+
You can add your Build and Test jobs between the `cloud-sync` and `cloud-artifact` jobs. Keep in mind that you do not need to retain the dotnet build artifact for upload later. The `cloud-artifact` job will take care of packaging all your source code and upload to Umbraco Cloud.
218237

238+
If you add Build and Test stages after `cloud-sync` make sure that you checkout the updated code in case there were applied a git patch to your repository.
219239
### Cloud-sync
220240

221-
The `cloud-sync.yml` shows how you can sync your GitHub repository with the left-most environment of your Cloud project. In this sample, it accepts any change from the API and applies and commits it back to the branch which triggered the pipeline. However the commit does not trigger the pipeline again.
241+
The `cloud-sync.yml` shows how you can sync your GitHub repository with the targeted environment of your Cloud project. In this sample, it accepts any change from the API and applies and commits it back to the branch which triggered the pipeline. However the commit does not trigger the pipeline again.
222242

223243
If you don't want the pipeline to commit back to the triggering branch, this is where you need to change the pipeline.
224244

225-
### Cloud-deployment
245+
### Cloud-artifact
226246

227-
The `cloud-deployment.yml` show how you can deploy your repository to the left-most environment of your Cloud project. The sample shows how to prepare for deployment, request the deployment and wait for cloud to finish.
247+
The `cloud-artifact.yml` shows how you can prepare and package an artifact and finally upload it to Umbraco Cloud.
228248

229249
There are a couple of things here to be aware of:
230250

231-
* We are overwriting the `.gitignore` file with `cloud.gitignore`. This is a way to accommodate your gitignore-needs when working locally. For instance you might want to ignore frontend builds, but you want them build and published to cloud.
232-
* We have a special `cloud.zipignore` file. This is a convenient way to tell the pipeline which files **not** to include when creating the zip package to send to cloud.
251+
* The sample is overwriting the `.gitignore` file with `cloud.gitignore`. This is a way to accommodate your gitignore-needs when working locally. For instance you might want to ignore frontend builds, but you want them build and published to cloud.
252+
* The sample contains a special `cloud.zipignore` file. This is a convenient way to tell the pipeline which files **not** to include when creating the zip package to send to cloud.
253+
254+
If you want to customize the artifact take a look at [Artifact Best Practice](../ArtifactBestPractice.md).
255+
256+
257+
### Cloud-deployment
258+
259+
The `cloud-deployment.yml` shows how you can deploy to a named environment of your Cloud project. The sample shows how to request the deployment and wait for cloud to finish the operation.
233260

234261
{% hint style="info" %}
235-
If you have frontend assets that needs to be build (using tools like npm/yarn or others), you should add the needed steps before `Zip Source Code`. This is to ensure that the fresh frontend assets will be part of the package to be sent to cloud.
262+
If you have frontend assets that needs to be built (using tools like npm/yarn or others), you should add the needed steps before `cloud-artifact`. This is to ensure that the fresh frontend assets will be part of the package to be sent to Umbraco Cloud.
236263
{% endhint %}
237264

238265
## Further information

0 commit comments

Comments
 (0)