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

Commit0ce8c6d

Browse files
committed
Edit how to articles
Streamlined more how to articles
1 parent776b65d commit0ce8c6d

6 files changed

+112
-80
lines changed

‎_docs/kb/articles/disable-status-updates-to-github.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ support-reviewed: 2023-04-18 LG
1313

1414

1515

16-
This article describes how to stop status update from a pipeline to GitHub.
16+
This article describes how to stop status updateto GitHubfrom a pipeline.
1717

1818
>**NOTE**
1919
Disabling status updates to GitHub is currently supported only via CLI for Codefresh pipelines.

‎_docs/kb/articles/ensure-cleanup-when-pipelines-stops.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The parallel step always runs at the end of the pipeline, regardless of its buil
2121

2222
##How to
2323

24-
In a sequential pipeline, which is the default execution mode for pipelines, manually terminating the pipeline, also terminates the execution of subsequent steps, including any pipeline hooks set to run on success or failure.
24+
In a sequential pipeline, which is the default execution mode for pipelines, manually terminating the pipeline also terminates the execution of subsequent steps, including any pipeline hooks set to run on success or failure.
2525

2626
You can circumvent this behavior by inserting a parallel step within the pipeline.
2727

‎_docs/kb/articles/gather-metrics-and-build-logs.md‎

Lines changed: 63 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title:"How To: Gather Codefresh Related MetricsandBuild Logs"
2+
title:"How To: Gather Codefresh-related metricsandbuild logs"
33
description:
44
group:kb
55
sub-group:articles
@@ -11,25 +11,27 @@ categories: [CLI, API, Pipelines]
1111
support-reviewed:2023-04-18 LG
1212
---
1313

14-
##Overview
14+
This article describes useful API calls to retrieve information on a pipeline build and its steps. It also describes the fields included as part of the response to those calls - to be used as-is or how to infer new metrics from the values.
1515

16-
This document summarizes some API calls that can be useful to get information about abuildand its steps.
16+
##Calls for pipelinebuildinformation
1717

18-
It also describes the fields included as part of the response to those calls to be used as-is or to infer new metrics out of those values.
18+
We will explore three main calls to programmatically get information about the build:
19+
* General build information
20+
`codefresh get build <BUILD_ID>` (could be changed to an API call, since that one has more information)
21+
* Build and steps information
22+
`GET /api/workflow/<BUILD_ID/context-revision`
23+
* Logs
24+
`GET https://g.codefresh.io/api/progress/<PROGRESS_ID>`
25+
This GET call also includes resource-consumption metrics. As they are not Prometheus-based, they are not accurate for specific step types, such as the build-step.
1926

20-
##Details
2127

22-
We’ll explore three main calls to programmatically get information about the build:
28+
##Usage script for CLI/API calls
2329

24-
* General build information:`codefresh get build <BUILD_ID>` (could be changed to an API call, since that one has more information)
25-
* Build and Steps information:`GET /api/workflow/<BUILD_ID/context-revision`
26-
* Logs:`GET https://g.codefresh.io/api/progress/<PROGRESS_ID>` (this one also has resource-consumption metrics, but they are not Prometheus-based, thus, for some steps, such as the build-step, they are not accurate)
30+
The following script is a suggestion on how to use the different CLI and API calls available.
2731

28-
Thefollowing scriptisa suggestion on how to use the different CLI and API calls available
32+
Theideaisto run this asynchronously. For example, using a cron-trigger in a pipeline in Codefresh to execute the pipeline daily.
2933

30-
The idea is to run this in an asynchronous fashion. For example, using a cron-trigger in a pipeline in Codefresh, to execute the pipeline every day.
31-
32-
The same calls can be used if you want to incorporate the process of pushing metrics into your monitoring platform, as part of the build itself (e.g., in a hook, at the end of the pipeline)
34+
You can also use the same calls to incorporate the process of pushing metrics into your monitoring platform, as part of the build itself. For example, in a hook, at the end of the pipeline.
3335

3436
```shell
3537
#!/bin/bash
@@ -66,7 +68,8 @@ do
6668
done
6769
```
6870

69-
This script will generate a JSON file per build, with the following structure:
71+
###Script response
72+
This script generates a JSON file per build with the following structure:
7073

7174
```json
7275
{
@@ -86,32 +89,34 @@ This script will generate a JSON file per build, with the following structure:
8689
}
8790
```
8891

89-
Description of each field:
90-
91-
*`created`: timestamp indicating when the build was created (“submitted“). Example:`2021-05-17T21:31:35.779Z`
92-
*`started`: timestamp indicating when the build was started (the Initializing Process started). Example:`2021-05-17T21:31:47.742Z`
93-
*`finished`: timestamp indicating when the build was started. Example:`2021-05-17T21:32:21.435Z`
94-
*`totalTime`: duration (in HH:MM:SS) of the build from`created` to`finished`
95-
*`buildTime`: duration (in HH:MM:SS) of the build from`started` to`finished`
96-
*`status`: status of the build (error, success, etc)
97-
*`pipeline-name`: Full name of the pipeline
98-
*`repository`: Name of the repo associated with the build execution. This will only be different to`/` if a git-trigger is used to trigger a build.
99-
*`webhook`: boolean indicating if the build was triggered by a webhook (sent by a git-provider, for example) or not.
100-
*`pipeline-Id`: the ID of the pipeline for the build
101-
*`stateYaml`: Object representing the last State of the build. It contains detailed information about the build and its steps. When the build doesn’t have a State YAML (e.g., the build was terminated before it could start), the value of this field will be an empty Object:`{}`.
92+
The table describes the fields in the JSON response.
10293

103-
###State YAML
94+
{: .table .table-bordered .table-hover}
95+
| Field| Description|
96+
|------------------|--------------------------------------------------------------------------------------------------------------|
97+
|`created`| The timestamp indicating when the build was created (submitted). Example:`2021-05-17T21:31:35.779Z`.|
98+
|`started`| The timestamp indicating when the build started execution, that is the start of the Initializing Process. Example:`2021-05-17T21:31:47.742Z`.|
99+
|`finished`| The timestamp indicating when the build completed execution. Example:`2021-05-17T21:32:21.435Z`.|
100+
|`totalTime`| The duration of the build, in HH:MM:SS, from`created` to`finished`.|
101+
|`buildTime`| The duration of the build, in HH:MM:SS, from`started` to`finished`.|
102+
|`status`| The status of the build. See[Viewing status for pipeline builds]({{site.baseurl}}/docs/pipelines/monitoring-pipelines/#viewing-status-for-pipeline-builds).|
103+
|`pipeline-name`| The full name of the pipeline .|
104+
|`repository`| The name of the repo associated with the build execution. This will only be different to`/` if a git-trigger is used to trigger a build.|
105+
|`webhook`| The boolean indication indicating if the build was triggered by a webhook, sent by a git-provider, for example or not.|
106+
|`pipeline-Id`| The ID of the pipeline for the build run.|
107+
|`stateYaml`| The object representing the last state of the build, containing detailed information about the build and its steps.<br> When the build doesn’t have a State YAML, as when it was terminated before it could start, the value of this field will be an empty Object:`{}`.|
104108

105-
The State YAML of the build is represented in the`stateYaml` field of each JSON file.
106109

107-
It’s composed of several fields, but the most relevant one is the`context` element.
110+
####State YAML
108111

109-
####Context (`stateYaml.context`)
112+
The State YAML of the build is represented in the`stateYaml` field of each JSON file.
113+
It includes several fields, but the most relevant one is the`context` element.
110114

115+
#####Context (`stateYaml.context`)
111116
*`workflowMetadata`: contains general information about the workflow (the build)
112117
*`stepsMetadata`: contains information about every step executed in the build
113118

114-
####Workflow Metadata (`workflowMetadata`)
119+
#####Workflow Metadata (`workflowMetadata`)
115120

116121
*`startTimestamp`: when the build process started. The next action is the execution of the pre-steps. Example:`2021-05-17T21:31:47.481Z`
117122
*`preStepsStartTimestamp`: once the build starts, it first executes the “preSteps“ (including the “Initializing Process“ step). This field is the timestamp when those pre-steps start. The next action would be the execution of the actual build-steps. Example:`2021-05-17T21:31:48.118Z`. Relative position in time:`startTimestamp`<`preStepsStartTimestamp`
@@ -124,22 +129,26 @@ It’s composed of several fields, but the most relevant one is the `context` el
124129
*`finishTimestamp`: timestamp indicating when the workflow is finished. Relative position in time:`preStepsFinishTimestamp`<`finishTimestamp`
125130
*`totalTime`: Integer. Duration in milliseconds of the build. This contemplates the time from the moment the pre-steps started to the moment the last step is executed. This doesn’t include the time the build was waiting to start (pending), nor the time the**post** -steps of the build. Example:`33708`
126131

127-
####Steps Metadata (`stepsMetadata`)
132+
#####Steps Metadata (`stepsMetadata`)
128133

129-
This object will have N Objects inside of it. Each of them representing a step in the build.
134+
This object has N Objects within, each representing a step in the build.
135+
The key of each object within`stepsMetadata` is the name of the step.
130136

131-
The key ofeach objectinside`stepsMetadata`will be the name of the step.
137+
In general,each objectwithin`stepsMetadata`include:
132138

133-
In general, each object inside the`stepsMetadata` field will have:
134-
135-
*`type`: the type of the step. Possible values:`freestyle`,`build`,`push`,`parallel`, etc (anything you put in`type` when defining your step
139+
*`type`: The step type. Possible values:`freestyle`,`build`,`push`,`parallel`, etc (anything you put in`type` when defining your step.
136140
*`result`:
137-
*`status` : same as`result`
141+
*`status`: Same as`result`
138142
*`totalTime`
139143

140-
Some clarification: the key`Initializing Process` is the one representing the Initializing Process, and it will only have`startTimestamp`,`status`,`finishTimestamp` and`totalTime`.
141144

142-
There’s a key called`Initializing` , it could be ignored.
145+
{{site.data.callout.callout_tip}}
146+
**TIP**
147+
The key`Initializing Process` representing the pipeline initialization stage has these values:`startTimestamp`,`status`,`finishTimestamp` and`totalTime`.
148+
The key`Initializing` can be ignored.
149+
{{site.data.callout.end}}
150+
151+
143152

144153
###Example of a build JSON created by the script
145154

@@ -226,11 +235,12 @@ There’s a key called `Initializing` , it could be ignored.
226235
}
227236
```
228237

229-
###Getting the build logs
238+
##Get build logs
230239

231-
Most of the time the information provided by the State YAML is enough, but if you require to push the logs of builds as well, then, this call(s) may help you.
240+
Generally,`State YAML` provides the information you need.
241+
If you also need to push the build logs, we have these calls to help.
232242

233-
To get thelogsof a build`BUILD_ID`, you need to:
243+
**Get buildlogsby`BUILD_ID`**:
234244

235245
```shell
236246
BUILD_ID=123xyz
@@ -256,7 +266,7 @@ printf "\tDownloading logs to ${BUILD_ID}.json \n"
256266
curl --silent$LOGS_URL --output${BUILD_ID}.json
257267
```
258268

259-
The`<BUILD_ID>.json` filewill have the following structure:
269+
This call results in a`<BUILD_ID>.json` filewith the following structure:
260270

261271
```json
262272
...
@@ -274,10 +284,13 @@ steps:
274284
...
275285
```
276286

277-
`steps` is an array of Steps, and each of the elements has a`logs` array.
278-
279-
The`logs` arrayhas the contentof the logsfor a step in specific (a line per array element).
287+
where:
288+
*`steps` is an array of steps, with each element including a`logs` array.
289+
*The`logs` arrayincludes thelogcontent for a step,a line per array element.
280290

281-
It’s important to mention that the calls above are only valid for builds that have already been finished (successful, failure, terminated)
282291

283-
You can use the script suggested at the beginning of this document to iterate over all the builds on a timeframe and get the logs from them.
292+
{{site.data.callout.callout_tip}}
293+
**TIP**
294+
The calls above are only valid for_completed_ successful, failure, or terminated builds.
295+
You can use the script at the beginning of this article to iterate over all the builds over a time frame and get the logs from them.
296+
{{site.data.callout.end}}

‎_docs/kb/articles/install-from-packagejson-not-located-root-dir.md‎

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

14-
##Overview
14+
This article describes how to run`npm install` from a directory other than the root.
1515

16-
You want to run npm install from a directory that is not the root directory.
1716

18-
##Details
1917

20-
###Option 1: Set the working directory
21-
22-
In your step, change the`working_directory` setting from {% raw %}`${{clone_step}}`{% endraw %} to {% raw %}`${{clone_step}}/subdir`{% endraw %}.
23-
24-
###Option 2: Change directory in step
18+
##Option 1: Set the working directory
19+
In your step, change the`working_directory` setting from:
20+
{% raw %}`${{clone_step}}`{% endraw %} to {% raw %}`${{clone_step}}/subdir`{% endraw %}.
2521

22+
##Option 2: Change directory in step
2623
In your step, add a command to change the directory:
2724

2825
```yaml
@@ -31,10 +28,8 @@ commands:
3128
-npm install
3229
```
3330
34-
>**_Note_**
35-
>
36-
>This logic can be applied for anything you need to use subdirectories for.
37-
38-
## Related Items
31+
>**NOTE**
32+
Apply this logic whenever you need to use subdirectories.
3933
34+
## Related articles
4035
[Working Directories]({{site.baseurl}}/docs/pipelines/what-is-the-codefresh-yaml/#working-directories)

‎_docs/kb/articles/mount-volumes-in-composition-step.md‎

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

14+
This article describes how to mount a volume within a named Docker volume to overcome the Docker limitation.
15+
16+
>**NOTE**
17+
This article is relevant when`docker-compose.yml` file in the`composition` step.
18+
19+
20+
21+
1422
##Overview
1523

16-
Compositions steps can only mount {% raw %}`${{CF_VOLUME_NAME}}:${{CF_VOLUME_PATH}}`{% endraw %}, but you need to mount`/codefresh/volume/<REPO>/<DIR>/` to`/<DIR>` . This is a limitation of docker where you cannot specify a directory inside a named docker volume[1].
24+
Compositions steps can only mount {% raw %}`${{CF_VOLUME_NAME}}:${{CF_VOLUME_PATH}}`{% endraw %}.
25+
26+
If you need to mount`/codefresh/volume/<REPO>/<DIR>/` to`/<DIR>`, due to a Docker limitation, you cannot specify a directory inside a named Docker volume. See[here](https://github.com/moby/moby/issues/32582){:target="\_blank"}.
1727

18-
**Note** : this is for using a`docker-compose.yml` file in the composition step.
28+
##How to
1929

20-
##Details
30+
#####Scenario
2131

22-
I have in my git rep sample data and need to mount this to the`/database` directory. My custom image is expecting data to be in`/database` to be able to run. My docker file already runs a script at startup when the container starts.
32+
* Sample data in Git repo must be mounted to`/database` directory.
33+
* The custom image needs access to`/database` for proper execution.
34+
* The Dockerfile already runs a script on container startup.
2335

24-
Sample`docker-compose.yml`
36+
#####Sample`docker-compose.yml`
2537

2638
```yaml
2739
version:'3.0'
@@ -32,7 +44,7 @@ services:
3244
-./:/database
3345
```
3446
35-
`Sample codefresh.yml`
47+
#####Sample`codefresh.yml`
3648

3749
{% raw %}
3850

@@ -80,11 +92,17 @@ steps:
8092
volumes:
8193
- ${{CF_VOLUME_NAME}}:${{CF_VOLUME_PATH}}
8294
```
83-
8495
{% endraw %}
8596

86-
In the conform step, we are replacing the volumes mount to be {% raw %}`${{CF_VOLUME_NAME}}:${{CF_VOLUME_PATH}}`{% endraw %}. Then add a command of {% raw %}`bash -c "ln -s ${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}/<DIR>/ /database && ./start.sh"`{% endraw %} to symlink the directory in my repo to the `/database` directory and then execute my script that's already in the container. Once this is done, my composition steps will run and have the correct mounts and directories where it is needed.
97+
In the `conform` step, `.arguments.KEYVALUE_PAIRS`:
98+
* Volumes mount is replaced to {% raw %}`${{CF_VOLUME_NAME}}:${{CF_VOLUME_PATH}}`{% endraw %}.
99+
* The command {% raw %}`bash -c "ln -s ${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}/<DIR>/ /database && ./start.sh"`{% endraw %}:
100+
* Symlinks the directory in the Git repo to the `/database` directory
101+
* Executes the script already in the container
102+
103+
Once this is done, `composition` steps will run and have the correct mounts and directories where needed.
87104

88-
## Related Items
105+
## Related articles
106+
[Composition steps in pipelines]({{site.baseurl}}/docs/pipelines/steps/composition/)
107+
[Pipeline definitions YAML]({{site.baseurl}}/docs/pipelines/what-is-the-codefresh-yaml/)
89108

90-
[1] <https://github.com/moby/moby/issues/32582>

‎_docs/kb/articles/which-pod-used-for-running-build.md‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title:"How To: Knowwhich builder podwasusedfor running a build"
2+
title:"How To: Knowthe builder pod usedto run build"
33
description:
44
group:kb
55
sub-group:articles
@@ -11,10 +11,16 @@ categories: [Pipelines]
1111
support-reviewed:2023-04-18 LG
1212
---
1313

14-
##Overview
14+
This article describes how to retrieve the specific builder pod used to run a build.
1515

16-
By default codefresh on-premises uses codefresh builders to run your builds. In case you configured more than one builder, you might need to know on which builder pod specific build was run on for debug purposes for example in case of networking issues in your k8s cluster
16+
##Multiple builders
17+
By default, Codefresh on-premises uses Codefresh builders to run your builds.
1718

18-
##Details
19+
If you configured more than one builder, you might need to know the builder pod that the specific build was run on, for debug purposes for example, to resolve networking issues in your k8s cluster.
20+
21+
To always locate the builder pod, simply output the builder pod name to the build logs.
22+
23+
##How to
24+
25+
* Add`echo $CF_HOST_NAME` to the commands list of one of the`freestyle` steps in the pipeline for which you need to track the builder name it runs on.
1926

20-
One of the ways you can use for this purpose is to output the builder pod name to the build logs so it can be easily found there in future. You just need to add`echo $CF_HOST_NAME` to the commands list of one of the freestyle steps in the pipeline for which you need to track the builder name it runs on.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp