Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions _docs/integrations/ci-integrations/codefresh-classic.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ toc: true

Use Hosted GitOps with any popular Continuous Integration (CI) solution, not just with Codefresh CI. Codefresh Classic is one of the third-party CI platform/tools that you can connect to Codefresh for deployment with image enrichment and reporting.



For information on how to use the image reporting action in your Codefresh Classic pipeline and how to configure the integration, see [CI Integrations]({{site.baseurl}}/docs/integrations/ci-integrations/).


Expand Down Expand Up @@ -37,6 +39,108 @@ The table describes the arguments required to connect Codefresh Classic to Codef

For how-to instructions, see [Connect a third-party CI platform/tool to Codefresh]({{site.baseurl}}/docs/integrations/ci-integrations/#connect-a-third-party-ci-platformtool-to-codefresh/).

### Templatization examples for CF arguments

Arguments such as `CF_IMAGE`, `CF_GIT_BRANCH`, and `CF_JIRA_MESSAGE` are populated dynamically when the Codefresh Classic integration pipeline is triggered. You can templatize the values of these arguments to ensure that the required information is included in the reported image.

Codefresh Classic offers [system variables](https://codefresh.io/docs/docs/codefresh-yaml/variables/#system-provided-variables) you can use to templatize argument values.

{::nomarkdown}
<br>
{:/}

#### CF_IMAGE examples
**Example: Report full repo and branch information**
This example illustrates how to define the value for `CF_IMAGE` to report the repo owner, name, and branch, with the Git hash.

Value:
{% raw %}`${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}:${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}`{% endraw %}

where:
* {% raw %}`${{CF_REPO_OWNER}}`{% endraw %} reports the owner of the repository. For example, `nr-codefresh`.
* {% raw %}`${{CF_REPO_NAME}}`{% endraw %} reports the name of the repository. For example, `codefresh-production`.
* {% raw %}`${{CF_BRANCH_TAG_NORMALIZED}}`{% endraw %} reports the normalized version of the branch name, without invalid characters in case the branch name is the Docker image tag name. For example, `pr-2345`, `new-auth-strategy` (branch names without normalization required), and `gcr.io/codefresh-inc/codefresh-io/argo-platform-audit.1.1909.0` (normalized version of original branch name `gcr.io/codefresh-inc/codefresh-io/argo-platform-audit:1.1909.0`).
* {% raw %}`${{CF_SHORT_REVISION}}`{% endraw %} reports the abbreviated 7-character revision hash, as used in Git. For example, `40659e7`.

**Example: Report a specific image tag**
This example illustrates how to define the value for `CF_IMAGE` value when you know the specific image version you want to report.

Value:
{% raw %}`{{CF_REPO_OWNER}}/${{CF_REPO_NAME}}:<v1.0>` {% endraw %}

where:
* {% raw %}`${{CF_REPO_OWNER}}`{% endraw %} and {% raw %}`${{CF_REPO_NAME}}`{% endraw %} report the names of the repository owner and the repository, respectively. For example, `nr-codefresh` and `codefresh-production`, respectively.
* {% raw %}`<v1.0>`{% endraw %} reports the hard-coded tag `v1.0`.

**Example: Report the latest Git tag available on repository**
This example illustrates how to define the value for `CF_IMAGE` value to report the latest Git tag on the repository.

Value:
{% raw %}`codefresh/${{CF_REPO_NAME}}:latest`{% endraw %}

where:
* {% raw %}`codefresh`{% endraw %} is the hard-coded owner of the image.
* {% raw %}`${{CF_REPO_NAME}}`{% endraw %} reports the name of the repository that triggered the pipeline. For example, `codefresh-production`.
* {% raw %}`latest`{% endraw %} reports the latest Git tag available for the repository defined by {% raw %}`${{CF_REPO_NAME}}`{% endraw %}. For example, `v1.0.4-14-g2414721`.

{::nomarkdown}
<br>
{:/}

#### CF_GIT_BRANCH examples

**Example: Report Git branch or tag with committer and commit message**

This example illustrates how to report the name or tag of the Git branch with committer and commit message.

Value:
{% raw %}`${{CF_REPO_NAME}}/${{CF_BRANCH}}:${{CF_COMMIT_AUTHOR}}/${{CF_COMMIT_MESSAGE}}`{% endraw %}

where:
* {% raw %}`${{CF_REPO_NAME}}`{% endraw %} reports the name of the repository. For example, `codefresh-production`.
* {% raw %}`${{CF_BRANCH}}`{% endraw %} reports the branch name or tag based on the JSON payload of the Git repository that triggered the pipeline. For example, `new-auth-strategy`.
* {% raw %}`${{CF_COMMIT_AUTHOR}}`{% endraw %} reports the name of the user who made the commit. For example, `cf-support`.
* {% raw %}`${{CF_COMMIT_MESSAGE}}`{% endraw %} reports the commit message of the repository. For example, `support oauth authentication for ci integrations`.


**Example: Report normalized Git branch or tag with committer and commit message**

This example illustrates how to report the normalized name or tag of the Git branch with committer and commit message.
Normalizing the branch name removes any invalid characters in the name if the branch name is also used as the Docker image tag name.

Value:

{% raw %}`${{CF_REPO_NAME}}/${{CF_BRANCH_TAG_NORMALIZED}}:${{CF_COMMIT_AUTHOR}}/${{CF_COMMIT_MESSAGE}}`{% endraw %}

where:
* {% raw %}`${{CF_REPO_NAME}}`{% endraw %} reports the name of the repository. For example, `codefresh-production`.
* {% raw %}`${{CF_BRANCH_TAG_NORMALIZED}}`{% endraw %} reports the normalized version of the branch name or tag based on the JSON payload of the Git repository that triggered the pipeline.
* {% raw %}`${{CF_COMMIT_AUTHOR}}`{% endraw %} reports the name of the user who made the commit. For example, `nr-codefresh`.
* {% raw %}`${{CF_COMMIT_MESSAGE}}`{% endraw %}reports the commit message of the repository. For example, `support oauth authentication for ci integrations`.

**Example: Report normalized Git branch or tag in lowercase with PR information**

This example illustrates how to report the normalized name or tag of the Git branch in lowercase, with PR (pull request) information.
Normalizing the branch name removes any invalid characters in the name if the branch name is also used as the Docker image tag name.

Value:
{% raw %}`${{CF_REPO_NAME}}/${{CF_BRANCH_TAG_NORMALIZED}}:${{CF_PULL_REQUEST_TARGET}}/${{CF_PULL_REQUEST_NUMBER}}`{% endraw %}

where:
* {% raw %}`${{CF_REPO_NAME}}`{% endraw %} reports the name of the repository. For example, `production`.
* {% raw %}`${{CF_BRANCH_TAG_NORMALIZED}}`{% endraw %} reports the normalized version of the branch name or tag based on the JSON payload of the Git repository that triggered the pipeline. For example, `pr-2345`, `new-auth-strategy` (branch names without normalization required), and `gcr.io/codefresh-inc/codefresh-io/argo-platform-audit.1.1909.0` (normalized version of original branch name `gcr.io/codefresh-inc/codefresh-io/argo-platform-audit:1.1909.0`).
* {% raw %}`${{CF_PULL_REQUEST_TARGET}}`{% endraw %} reports the target branch of the PR. For example, `new-auth-strategy`.
* {% raw %}`${{CF_PULL_REQUEST_NUMBER}}`{% endraw %} reports the number of the PR. For example, `#323`.

{::nomarkdown}
<br>
{:/}

#### CF_JIRA_MESSAGE examples
The Jira message represents an existing Jira issue, and must be a literal string.

Value:
`CR-1246`

### Example of report image step in Codefresh Classic pipeline

Expand Down
84 changes: 84 additions & 0 deletions _docs/integrations/ci-integrations/github-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,90 @@ max-width="50%"

For how-to instructions, see [Connect a third-party CI platform/tool to Codefresh]({{site.baseurl}}/docs/integrations/ci-integrations/#connect-a-third-party-ci-platformtool-to-codefresh).

### Templatization examples for CF arguments

Arguments such as `CF_IMAGE`, `CF_GIT_BRANCH`, and `CF_JIRA_MESSAGE` are populated dynamically when the GitHub Actions pipeline is triggered. You can templatize the values of these arguments to ensure that the required information is included in the reported image.

See GitHub Actions [environment variables](https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables) you can use to templatize argument values.

{::nomarkdown}
<br>
{:/}

#### CF_IMAGE

**Example: Report full repo and branch information**
This example illustrates how to define the value for `CF_IMAGE` to report the repo owner, name, and short branch, with the Git hash.

Value:
{% raw %}`${{ github.repository }}/${{ github.ref_name }}/${{ github.sha }}`{% endraw %}

where:
* {% raw %}`${{ github.repository }}`{% endraw %} reports the owner of the repository and the name of the repository. For example, `nr-codefresh/codefresh-production`.
* {% raw %}`${{ github.ref_name }}`{% endraw %} reports the short reference to the branch that triggered the workflow. For example, `auth-feature-branch`.
* {% raw %}`${{ github.sha }}`{% endraw %} reports the complete commit SHA that triggered the workflow. For example, `fa53bfa91df14c4c9f46e628a65ee21dd574490a`.



**Example: Report a specific image tag**
This example illustrates how to define the value for `CF_IMAGE` when you know the specific image version you want to report.

Value:
{% raw %}`${{ github.repository }}:<v1.0>`{% endraw %}

where:
* {% raw %}`${{ github.repository }}`{% endraw %} reports the owner of the repository and the name of the repository. For example, `nr-codefresh/codefresh-production`.
* `<v1.0>` reports the hard-coded tag `v1.0`.


**Example: Report the latest Git tag available on repository**
This example illustrates how to define the value for `CF_IMAGE` to report the latest Git tag on the repository.

Value:
{% raw %}`codefresh/${{ github.repository }}/latest`{% endraw %}

where:
* {% raw %}`codefresh`{% endraw %} is the hard-coded owner of the image.
* {% raw %}`${{ github.repository }}`{% endraw %} reports the owner of the repository and the name of the repository. For example, `nr-codefresh/codefresh-production`.
* {% raw %}`latest`{% endraw %} reports the latest Git tag available for the repository defined by {% raw %}`${{ github.repository }}`{% endraw %}. For example, `v1.0.4-14-g2414721`.

{::nomarkdown}
<br>
{:/}

#### CF_GIT_BRANCH

**Example: Report fully-formed reference of the branch or tag**
This example illustrates how to define the value for `CF_GIT_BRANCH` to report the fully-formed reference of the branch or tag that triggered the workflow run.
For workflows triggered by push events, this is the branch or tag ref that was pushed.
For workflows triggered by pull_requests, this is the pull request merge branch.

Value:
{% raw %}`${{ github.ref }}`{% endraw %}

where:
* {% raw %}`${{ github.ref }}`{% endraw %} is the reference to the branch or tag. For example, `refs/heads/auth-feature-branch` (branch), and `refs/pull/#843/merge` (pull request).

**Example: Report short reference name of the branch or tag**
This example illustrates how to define the value for `CF_GIT_BRANCH` to report only the name of the branch or tag that triggered the workflow run.


Value:
{% raw %}`${{ github.ref-name }}`{% endraw %}

where:
* {% raw %}`${{ github.ref-name }}`{% endraw %} is the name of the target branch or tag. For example, `auth-feature-branch`.

{::nomarkdown}
<br>
{:/}

#### CF_JIRA_MESSAGE
The Jira message represents an existing Jira issue, and must be a literal string.

Value:
`CR-1246`

### GitHub Actions pipeline example

Here is an example pipeline that uses GitHub Actions to build a container image, and the Codefresh action to enrich and report the resulting image to Codefresh.
Expand Down
83 changes: 83 additions & 0 deletions _docs/integrations/ci-integrations/jenkins.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,89 @@ The table describes the arguments to connect Codefresh Classic to Codefresh.

For how-to instructions, see [Connect a third-party CI platform/tool to Codefresh]({{site.baseurl}}/docs/integrations/ci-integrations/#connect-a-third-party-ci-platform-tool-to-codefresh).

### Templatization examples for CF arguments

Arguments such as `CF_IMAGE`, `CF_GIT_BRANCH`, and `CF_JIRA_MESSAGE` are populated dynamically when the Jenkins pipeline is triggered. You can templatize the values of these arguments in the pipeline to ensure that the required information is included in the reported image.

Jenkins offers a Git plugin with [environment variables](https://plugins.jenkins.io/git/#plugin-content-environment-variables){:target="\_blank"} you can use to templatize argument values.

{::nomarkdown}
<br>
{:/}

#### CF_IMAGE
**Example: Report repo, branch with Git hash**
This example illustrates how to define the value for `CF_IMAGE` to report Git repo, branch, committer, and Git hash information.

Value:
{% raw %}`${env.GIT_COMMITTER_NAME}/${env.GIT_URL}/${env.GIT_BRANCH}/${env.GIT_REVISION}`{% endraw %}

where:
* {% raw %}`${env.GIT_COMMITTER_NAME}`{% endraw %} reports the name of the user who made the commit. For example, `nr-codefresh`.
* {% raw %}`${env.GIT_URL}`{% endraw %} reports the name of the Git repository. For example, `codefresh-production`.
* {% raw %}`${env.GIT_BRANCH}`{% endraw %} reports the name of the Git branch. For example, `pr-2345`, `new-auth-strategy`.
* {% raw %}`${env.GIT_REVISION}`{% endraw %} reports the Git SHA1 commit ID pointing to the commit that was built. For example, `fa53bfa91df14c4c9f46e628a65ee21dd574490a`.


**Example: Report a specific image tag**
This example illustrates how to define the value for `CF_IMAGE` when you know the specific image version you want to report.

Value:
{% raw %}`${env.GIT_COMMITTER_NAME}/${env.GIT_URL}/<v1.0>`{% endraw %}

where:
* {% raw %}`${env.GIT_COMMITTER_NAME}`{% endraw %} and {% raw %}`${env.GIT_URL}`{% endraw %} report the names of the user hwo made the commit and the repository, respectively. For example, `nr-codefresh` and `codefresh-production`, respectively.
* {% raw %}`<v1.0>`{% endraw %} reports the hard-coded tag `v1.0`.


**Example: Report the latest Git tag available on repository**
This example illustrates how to define the value for `CF_IMAGE` value to report the latest Git tag on the repository.

Value:
{% raw %}`codefresh/${env.GIT_URL}/latest`{% endraw %}

where:
* {% raw %}`codefresh`{% endraw %} is the hard-coded re
* {% raw %}`${env.GIT_URL}`{% endraw %} reports the name of the repository that triggered the integration.
* {% raw %}`latest`{% endraw %} reports the latest Git tag available for the repository defined by {% raw %}`${env.GIT_URL}`{% endraw %}. For example, `v1.0.4-14-g2414721`.

{::nomarkdown}
<br>
{:/}

#### CF_GIT_BRANCH

**Example: Report the fully-formed Git branch**
This example illustrates how to define the value for `CF_GIT_BRANCH` value to report the fully-formed Git branch.

Value:
{% raw %}`${env.GIT_URL}/${env.GIT_BRANCH}`{% endraw %}

where:
* {% raw %}`${env.GIT_URL}`{% endraw %} is the name of the repository that triggered the pipeline. For example, `codefresh-production`.
* {% raw %}`${env.GIT_BRANCH}`{% endraw %} is the fully-formed name of the Git branch. For example, `origin/auth-feature-branch`.


**Example: Report the local Git branch**
This example illustrates how to define the value for `CF_GIT_BRANCH` value to report only the branch in the repository that triggerred the pipeline.

Value:
{% raw %}`${env.GIT_URL}/${env.GIT_LOCAL_BRANCH}`{% endraw %}

where:
* {% raw %}`${env.GIT_URL}`{% endraw %} is the name of the repository that triggered the piepline.
* {% raw %}`${env.GIT_LOCAL_BRANCH}`{% endraw %} is the name of the Git branch. For example, `auth-feature-branch`.

{::nomarkdown}
<br>
{:/}

#### CF_JIRA_MESSAGE
The Jira message represents an existing Jira issue, and must be a literal string.

Value:
`CR-1246`


### Example of Jenkins pipeline with report image step

Expand Down