Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit130dd6e

Browse files
committed
Update How Tos continued
Edited more How Tos for consistency
1 parent28f2fa1 commit130dd6e

File tree

5 files changed

+60
-51
lines changed

5 files changed

+60
-51
lines changed

‎_docs/kb/articles/check-env-vars-in-conditionals.md‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@ categories: [Pipelines]
1111
support-reviewed:2023-04-18 LG
1212
---
1313

14-
##Overview
14+
This article outlines how to execute a specific step conditionally based on the presence or absence of a variable in Codefresh pipelines, enabling branching logic within a single pipeline.
1515

16-
You are trying to run a specific step only if a variable is set. You are trying to have branching logic in one pipeline.
17-
18-
19-
This condition determines how values are substituted for variables, when and if referenced variables do not exist in the pipeline definitions. In such cases, Codefresh retains the variable name string as-is, without substituting it with a value.
20-
16+
The condition determines how variable values are substituted within the pipeline's build when these variables are not defined in the pipeline configuration. In such instances, Codefresh maintains the variable name string unchanged, without replacing it with a value.
2117

2218
The following condition:
2319

@@ -30,9 +26,11 @@ The following condition:
3026

3127
evaluates to`true` if`CF_RELEASE_TAG` does not exist, and`false` if it does exist.
3228

33-
##Details
29+
##How to
3430

35-
1. Using the following syntax, you can check whether a variable exists for the current build:
31+
#####Check if variable exists for the current build
32+
33+
Use the following syntax:
3634

3735
{% raw %}
3836

@@ -45,7 +43,9 @@ evaluates to `true` if `CF_RELEASE_TAG` does not exist, and `false` if it does e
4543

4644
{% endraw %}
4745

48-
2. The following syntax can be used to check for a specific value:
46+
#####Check if variable has a specific value
47+
48+
Use the following syntax:
4949

5050
{% raw %}
5151

@@ -58,9 +58,9 @@ evaluates to `true` if `CF_RELEASE_TAG` does not exist, and `false` if it does e
5858

5959
{% endraw %}
6060

61-
3. If desired, you can combinemultiple checks.
61+
Combinemultiple checks as required.
6262

6363

6464

65-
## RelatedItems
66-
[Conditional execution of steps]({{site.baseurl}}/docs/pipelines/conditional-execution-of-steps/)
65+
##Relatedarticles
66+
[Conditional execution of steps]({{site.baseurl}}/docs/pipelines/conditional-execution-of-steps/)
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title:"How To: Check out onlythe PR merge commit, and not the HEAD ofthe target branch"
2+
title:"How To: Check out onlypull request merge commit for target branch instead ofHEAD"
33
description:
44
group:kb
55
sub-group:articles
@@ -11,22 +11,24 @@ categories: [Pipelines]
1111
support-reviewed:2023-05-04 LG
1212
---
1313

14-
##Overview
14+
This article describes how to check out only the merge commit of a PR (Pull Request) instead of the HEAD of the target branch.
1515

16-
Sometimes, when you re-run a pipeline based on a PR you might find your tests that passed the first time failing the second time. This can happen because the default behavior of your pipeline is to run based on a merge of the PR and the HEAD of the target branch - so it includes the latest changes to HEAD that may not have present when the PR itself was first made.
16+
When re-running a pipeline based on a PR, tests that passed the previous fails during the rerun.
17+
This can happen because the default behavior of the pipeline is to run based on a merge of the PR and the HEAD of the target branch. This behavior includes the latest changes to HEAD which may not have been present when the PR itself was created.
1718

1819
##Details
1920

20-
If you want a pipelineto only runagainst the target branch asit wasat the time of thepull request, you can clone your repository using the exact SHA of the merge request.
21+
To only run the pipeline against the target branch as at the time of thePR, clone your repository using the exact SHA of the merge request.
2122

22-
WhenCodefreshis triggered by aPull Request, your pipeline will haveaccess tosomeadditional variables[1]. This includesCF_PULL_REQUEST_MERGED_COMMIT_SHA, which is the commit SHA on the base branch after thepull request was merged.
23+
Whenthe pipelineis triggered by aPR, it hasaccess to additional variablesincluding`CF_PULL_REQUEST_MERGED_COMMIT_SHA`, which is the commit SHA on the base branch after thePR was merged.
2324

24-
You can set up your pipeline to test and see if this variable exists[2], and depending on it's existence do two different clone steps. One clone as your existing clone if the variable is not there, or a second clone step if it is that uses CF_PULL_REQUEST_MERGED_COMMIT_SHA in the`revision` field of your clone step[3] to check out your codebase as it was at the exact moment of the PR with the PR merged into it.
25+
Configure[conditional execution for the pipeline]({{site.baseurl}}/docs/pipelines/conditional-execution-of-steps/) to check if the`CF_PULL_REQUEST_MERGED_COMMIT_SHA` variable exists.
26+
Depending on result, execute one of two`git-clone` steps:
27+
* If the variable exists, specify it in the`revision` field of your`git-clone` step. This ensures that your codebase is checked out to the state it was at the precise moment the PR was merged.
28+
* If the variable does not exist, continue with your regular clone process.
2529

26-
##Related Items
2730

28-
[1]<https://codefresh.io/docs/docs/pipelines/variables/#github-pull-request-variables>
29-
30-
[2]<https://codefresh.io/docs/docs/kb/articles/check-env-vars-in-conditionals/>
31-
32-
[3]<https://codefresh.io/docs/docs/pipelines/steps/git-clone/#fields>
31+
##Related articles
32+
[GitHub Pull Request variables]({{site.baseurl}}/docs/pipelines/variables/#github-pull-request-variables)
33+
[Check environment variable value or existence in conditionals]({{site.baseurl}}/kb/articles/check-env-vars-in-conditionals)
34+
[Fields for`git-clone` step]({{site.baseurl}}/docs/pipelines/steps/git-clone/#fields)

‎_docs/kb/articles/check-potentially-unstable-service.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This article describes how to check for a service that may be inaccessible for a
1919

2020
##How to
2121

22-
* In thepipline step, add the`retry` attribute, as in the following example:
22+
* In thepipeline step, add the`retry` attribute, as in the following example:
2323

2424
```yaml
2525
steps:
@@ -33,7 +33,7 @@ steps:
3333
exponentialFactor:2
3434
```
3535
36-
>**NOTE**
36+
>**NOTE**
3737
Every retry attempt uses up one of your concurrent builds. For this reason, we suggest limiting the amount of retries.
3838
3939
## Related articles

‎_docs/kb/articles/clone-backup-pipelines-projects.md‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,30 @@ categories: [Pipelines, CLI]
1111
support-reviewed:2023-04-18 LG
1212
---
1313

14-
##Overview
1514

16-
You would liketo back up yourPipelines orProjects locally.
15+
This article describes howto back up yourpipelines orprojects locally.
1716

18-
##Details
17+
##How to
1918

20-
You will need to have the[Codefresh CLI installed](https://codefresh-io.github.io/cli/installation/). When installed, run the following command:
19+
#####Prerequisite
20+
[Install the Codefresh CLI](https://codefresh-io.github.io/cli/installation/).
2121

22-
{% raw %}
22+
#####Commands
23+
24+
**Back up the pipeline**
2325

26+
{% raw %}
2427
```shell
25-
codefresh get pip"pipeline_name" -o yaml> pipeline_backup_file
28+
codefresh get pip"<pipeline_name>" -o yaml><pipeline_backup_file>
2629
```
27-
2830
{% endraw %}
2931

30-
If you would like to export protected variables, run the following:
32+
where:
33+
*`"<pipeline_name>"` is the name of the pipeline to back up.
34+
*`<pipeline_backup_file>` is the name of the file to which to save the backed up pipeline.
35+
36+
37+
**Export protected variables**
3138

3239
{% raw %}
3340

@@ -37,7 +44,8 @@ codefresh get pip "pipeline_name" --decrypt-variables -o yaml > pipeline_backup
3744

3845
{% endraw %}
3946

40-
To recreate a pipeline from a backup file, run the following command:
47+
48+
**Recreate a pipeline from a backup file**
4149

4250
{% raw %}
4351

@@ -47,6 +55,4 @@ codefresh replace -f pipeline_backup_file
4755

4856
{% endraw %}
4957

50-
##Related Items
5158

52-
[Codefresh CLI](https://codefresh-io.github.io/cli/installation/)

‎_docs/kb/articles/clone-target-instead-of-branch-on-pr.md‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title:"How To: Clone target instead of source branchon pull request"
2+
title:"How To: Clone target instead of source branchfor pull request"
33
description:
44
group:kb
55
sub-group:articles
@@ -11,19 +11,24 @@ categories: [Pipelines]
1111
support-reviewed:2023-04-18 LG
1212
---
1313

14-
##Overview
14+
This article describes how to clone the target instead of the source branch in a PR (pull request)-triggered build.
1515

16-
In most cases,buildswilluse thevariable`CF_BRANCH` to referencethebranchassociated with agit triggered build.
16+
Typically, pipelinebuilds use the`CF_BRANCH`variableto referencethe branchassociated with abuild triggeredby a Git event. However, in the case of abuild triggered by a PR,`CF_BRANCH` specifically references the source branch. To clone the_target branch_ instead of the_source branch_ during a merge, use the`CF_PULL_REQUEST_TARGET` variable, which specifically points to the target branch.
1717

18-
In a pull request triggered build,`CF_BRANCH` specifically refers to the
19-
source branch, and another variable`CF_PULL_REQUEST_TARGET` refers to the
20-
target branch. You may need to use the target branch instead in your merge
21-
build.
2218

23-
##Details
2419

25-
* Create a separate pipeline that uses {% raw %}`${{CF_PULL_REQUEST_TARGET}}`{% endraw %} instead of the standard {% raw %}`${{CF_BRANCH}}`{% endraw %} or
26-
* Add the following step before your clone step to check if`CF_PULL_REQUEST_TARGET` exists, and if it does assign its value to`CF_BRANCH`:
20+
##How to
21+
22+
>**NOTE**
23+
`CF_BRANCH` is available only for PR-triggered builds. Updating its value to match`CF_PULL_REQUEST_TARGET` clones the target branch instead.
24+
If`CF_PULL_REQUEST_TARGET` is not present, the build defaults to cloning the source branch.
25+
26+
<!--- >>💡 The ability to override predefined variables such as `CF_BRANCH` was added recently and may be disabled for your account. If the approach described in this article does not work in your account, please [contact support](https://support.codefresh.io/hc/en-us/requests/new).-->
27+
28+
* Create a separate pipeline that uses {% raw %}`${{CF_PULL_REQUEST_TARGET}}`{% endraw %} instead of the standard {% raw %}`${{CF_BRANCH}}`{% endraw %}
29+
OR
30+
* Add the following step before your`git-clone` step to check if`CF_PULL_REQUEST_TARGET` exists.
31+
If it does, to assign its value to`CF_BRANCH`:
2732

2833
{% raw %}
2934

@@ -44,8 +49,4 @@ build.
4449
4550
{% endraw %}
4651
47-
>_Note:_
48-
>
49-
>`CF_BRANCH` is the source branch in a PR-initiated build. By updating its value to the value of `CF_PULL_REQUEST_TARGET` the target will be pulled instead. This variable only exists for PR triggered builds, and if not present the build will clone the source branch instead.
5052
51-
>💡 The ability to override predefined variables such as `CF_BRANCH` was added recently and may be disabled for your account. If the approach described in this article does not work in your account, please [contact support](https://support.codefresh.io/hc/en-us/requests/new).

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp