### Helm Install Action Example Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/deployments/helm/using-helm-in-codefresh-pipeline.md Illustrates how to configure the Helm freestyle step for installing a chart. This example shows setting the action to 'install' and providing necessary arguments like chart name, release name, Helm version, Kubernetes context, and custom values. ```yaml deploy: type: helm:1.1.12 arguments: action: install chart_name: test_chart release_name: first helm_version: 3.0.3 kube_context: my-kubernetes-context custom_values: - 'pat.arr="{one,two,three}"' - 'STR_WITH_COMAS="one\,two\,three"' ``` -------------------------------- ### Basic Freestyle Step Example Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/pipelines/steps/freestyle.md This example demonstrates a simple Freestyle step to install dependencies, mirroring a local 'docker run' command. ```yaml CollectAllMyDeps: title: Install dependencies image: python:3.6.4-alpine3.6 commands: - pip install . ``` -------------------------------- ### Example values.yaml for Helm Runtime Installation Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/gitops/migrate-cli-runtimes-helm.md This is an example of a values.yaml file containing essential configuration settings for the GitOps Runtime installation, including account ID, API token, and runtime name. ```yaml global: codefresh: accountId: userToken: token: runtime: name: ``` -------------------------------- ### Example values.yaml for on-prem GitOps Runtime Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/gitops/on-prem-gitops-runtime-install.md This is an example values.yaml file for installing the GitOps Runtime on-premises. It includes required configurations for the Codefresh platform URL, user token, runtime name, and ingress settings. Ensure the platform URL and ingress host are correctly set. ```yaml global: codefresh: url: https://codefresh-onprem.com ## required, replace with your platform URL userToken: token: 16363747847837838757885898 ## required, use an existing Codefresh API token or generate a new one runtime: name: noamg-runtime ingress: # on-prem supports only ingress-based enabled: true hosts: - codefresh.ingress-host.com ## required, replace with host used to access the runtime without `https://` app-proxy: config: cors: https://codefresh-onprem.com ## required, must be identical to platform URL ``` -------------------------------- ### Initialize Codefresh Runner Installation Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/runner/install-codefresh-runner.md Starts the Codefresh Runner installation wizard via the CLI. Use the `--help` flag to explore all available configuration options. ```shell codefresh runner init ``` -------------------------------- ### Full Git Trigger Configuration Example Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/integrations/codefresh-api.md This example demonstrates a comprehensive Git trigger setup, including repository details, event subscriptions, branch and comment filtering, file globbing, provider selection, caching options, context, variables, and runtime environment overrides. ```yaml triggers: - name: guysalton-codefresh/helm-sample-app type: git repo: guysalton-codefresh/helm-sample-app events: - push.heads - pullrequest.commentAdded pullRequestAllowForkEvents: true commentRegex: /.*/gi branchRegex: /^((master|develop)$).*/gi branchRegexInput: regex modifiedFilesGlob: /project1/** provider: github disabled: false options: noCache: false noCfCache: false resetVolume: false verified: true context: guyGithub contexts: - artifactory variables: - key: key value: '*****' encrypted: true runtimeEnvironment: name: docker-desktop/cf cpu: 400m memory: 800Mi dindStorage: nullGi ``` -------------------------------- ### Run PostgreSQL Instance Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/example-catalog/ci-examples/populate-a-database-with-existing-data.md Starts a PostgreSQL database instance using Docker. Ensure Docker is installed and running on your system before executing this command. ```bash docker run -p 5432:5432 postgres:11.5 ``` -------------------------------- ### Install First GitOps Runtime (Namespace Scope) Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/gitops/runtime-install-namespace-scope.md Install the initial GitOps Runtime with CRD installation enabled. This command uses Helm to deploy the runtime with specified values files and environment variables. ```bash helm upgrade ${RELEASE_NAME} --install --namespace ${NAMESPACE} --create-namespace --kube-context ${CONTEXT} --set global.runtime.name=${RUNTIME_NAME} --set "global.runtime.ingress.hosts[0]=${INGRESS_HOST}" -f values.yaml -f multi-values.yaml -f first-values.yaml oci://quay.io/codefresh/gitops-runtime:0.24.0 ``` -------------------------------- ### Install GitOps CLI using Homebrew Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/gitops/upgrade-gitops-cli.md Install the GitOps CLI using Homebrew by tapping the Codefresh repository and then installing the `cf2` package. This is a convenient method for macOS users. ```bash brew tap codefresh-io/cli && brew install cf2 ``` -------------------------------- ### Install GitOps CLI using curl for Linux X64 Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/gitops/upgrade-gitops-cli.md Use this command to download and install the GitOps CLI for Linux on 64-bit (x64) architecture. It downloads the archive, extracts it, moves the binary to the default path, and verifies the installation. ```bash curl -L --output - https://github.com/codefresh-io/cli-v2/releases/latest/download/cf-linux-amd64.tar.gz | tar zx && mv ./cf-linux-amd64 /usr/local/bin/cf && cf version ``` -------------------------------- ### Clone and Deploy Example Application Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/ci-cd-guides/progressive-delivery.md Clone the sample application repository and apply its Kubernetes manifests to set up a blue/green deployment environment. ```bash git clone https://github.com/codefresh-contrib/argo-rollout-blue-green-sample-app.git cd argo-rollout-blue-green-sample-app kubectl create ns blue-green kubectl apply -f ./blue-green-manual-approval -n blue-green ``` -------------------------------- ### Run Example Application Locally Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/ci-cd-guides/environment-deployments.md Clone the example application repository, build the Docker image, and run the application locally to view its configuration. ```bash git clone https://github.com/codefresh-contrib/helm-promotion-sample-app.git cd helm-promotion-sample-app docker build . -t my-app docker run -p 8080:8080 my-app ``` -------------------------------- ### Serve Development Documentation Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/README.md Run this command from the root directory to serve the development version of the documentation. ```bash npm run docs-serve-dev ``` -------------------------------- ### Codefresh CLI ArgoCD Agent Installation Wizard Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/integrations/argocd.md This is an example of the interactive prompts you will encounter when installing the Codefresh ArgoCD agent. It covers selecting contexts, integration names, authentication methods, and sync behaviors. ```bash codefresh install gitops argocd-agent This installer will guide you through the Codefresh ArgoCD installation agent to integrate your ArgoCD with Codefresh ? Select Kubernetes context mydemoAkscluster ? Codefresh integration name argocd ? Choose an authentication method Username and password ? Argo username admin ? Argo password ***************************** Testing requirements -------------------- √ checking argocd credentials... √ checking argocd projects accessibility... √ checking argocd applications accessibility... -------------------- ? Select Git/GithubApp context (Please create a dedicated context for the agent to avoid hitting the Github rate limits or use github app integration) github-1 ? Select argocd sync behavior please Import all existing Argo applications to Codefresh ? Enable auto-sync of applications, this will import all existing applications and update Codefresh in the future Yes Installation options summary: 1. Kubernetes Context: 2. Kubernetes Namespace: argocd 3. Git Integration: github-1 4. Codefresh Host: https://g.codefresh.io 5. ArgoCD Host: https://52.154.209.119 6. ArgoCD Username: admin 7. ArgoCD Password: ******** 8. Enable auto-sync of applications: Yes 9. HTTP proxy: none 10. HTTPS proxy: none Argo agent installation finished successfully to namespace "argocd" Gitops view: "https://g.codefresh.io/gitops" Documentation: "https://codefresh.io/docs/docs/ci-cd-guides/gitops-deployments/" ``` -------------------------------- ### On-Start Promotion Hook Example Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/promotions/promotion-workflow.md This example demonstrates an on-start hook in a Promotion Workflow that sends a Slack notification when a product release or environment promotion begins. It requires a Slack webhook URL and defines parameters for release details. ```yaml apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: name: on-start-hook annotations: codefresh.io/workflow-origin: promotion version: 0.0.1 spec: arguments: parameters: - name: RELEASE_URL - name: PRODUCT_NAME - name: COMMIT_SHA - name: PROMOTION_FLOW_NAME - name: RELEASE_ID serviceAccountName: hook entrypoint: send-message templates: # Send-message template - name: send-message retryStrategy: limit: "1" retryPolicy: "Always" backoff: duration: "5s" inputs: parameters: - name: MODE value: "simple" - name: SLACK_HOOK_URL value: - name: SLACK_TEXT value: Successfully started a release flow {{workflow.parameters.RELEASE_URL}}! container: name: main imagePullPolicy: Always image: quay.io/codefreshplugins/argo-hub-slack-send-message:0.0.2-main command: - node - /usr/src/app/index.js env: - name: MODE value: '{{ inputs.parameters.MODE }}' - name: SLACK_HOOK_URL value: '{{ inputs.parameters.SLACK_HOOK_URL }}' - name: SLACK_TEXT value: '{{ inputs.parameters.SLACK_TEXT }}' ``` -------------------------------- ### Clone and Deploy Example Application Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/ci-cd-guides/progressive-delivery.md Clone the sample application repository and deploy it to a Kubernetes namespace. This is a prerequisite for observing canary deployments. ```bash git clone https://github.com/codefresh-contrib/argo-rollout-canary-sample-app.git cd argo-rollout-canary-sample-app kubectl create ns canary kubectl apply -f ./canary-manual-approval -n canary ``` -------------------------------- ### Default Runtime Environment Specifications Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/runner/install-codefresh-runner.md Example of the default and basic runtime spec after installing the Codefresh Runner. This defines the core configuration for the runner's operation. ```yaml version: 1 metadata: ... runtimeScheduler: cluster: clusterProvider: accountId: 5f048d85eb107d52b16c53ea selector: my-eks-cluster namespace: codefresh serviceAccount: codefresh-engine annotations: {} dockerDaemonScheduler: cluster: clusterProvider: accountId: 5f048d85eb107d52b16c53ea selector: my-eks-cluster namespace: codefresh serviceAccount: codefresh-engine annotations: {} userAccess: true defaultDindResources: requests: '' pvcs: dind: storageClassName: dind-local-volumes-runner-codefresh extends: - system/default/hybrid/k8s_low_limits description: '...' accountId: 5f048d85eb107d52b16c53ea ``` -------------------------------- ### Example Pipeline with Multiple Stages Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/pipelines/stages.md A concrete example demonstrating how to define multiple stages and assign various steps to them. This configuration visually groups steps like 'prepare', 'test', 'build', 'scan', 'integration', and 'deploy'. ```yaml version: '1.0' stages: - prepare - test - build - scan - integration - deploy steps: step1: stage: 'prepare' image: node commands: - 'echo "Hello Step 1!"' step2: image: node stage: 'prepare' commands: - 'echo "Hello Step 2!"' step3: image: node stage: 'test' commands: - 'echo "Hello Step 3!"' step4: image: node stage: 'build' commands: - 'echo "Hello Step 4!"' step5: image: node stage: 'scan' commands: - 'echo "Hello Step 5!"' step6: image: node stage: 'scan' commands: - 'echo "Hello Step 6!"' step7: image: node stage: 'integration' commands: - 'echo "Hello Step 7!"' step8: image: node stage: 'deploy' commands: - 'echo "Hello Step 8!"' step9: image: node stage: 'deploy' commands: - 'echo "Hello Step 9!"' ``` -------------------------------- ### Run a step at the start of the pipeline Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/pipelines/hooks.md Use the `on_elected` hook to execute a step at the beginning of the pipeline, for tasks like setting up an environment. It can be combined with `on_finish` for setup and teardown. ```yaml version: "1.0" hooks: on_elected: exec: image: alpine:3.9 commands: - echo "Creating an adhoc test environment" on_finish: exec: image: alpine:3.9 commands: - echo "Destroying test environment" steps: step1: title: "Step 1" type: "freestyle" image: node:10-buster commands: - echo "Running Integration tests on test environment" step2: title: "Step 2" type: "freestyle" image: node:10-buster commands: - echo "Running acceptance tests on test environment" ``` -------------------------------- ### Install First GitOps Runtime (with CRDs) Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_gitops/gitops-runtimes/runtime-install-namespace-scope.md Install the initial GitOps Runtime, including CRDs, using Helm. This command sets up the runtime in a dedicated namespace with specified configurations. ```bash helm upgrade ${RELEASE_NAME} --install --namespace ${NAMESPACE} --create-namespace --kube-context ${CONTEXT} --set global.runtime.name=${RUNTIME_NAME} --set "global.runtime.ingress.hosts[0]=${INGRESS_HOST}" -f values.yaml -f multi-values.yaml -f first-values.yaml oci://quay.io/codefresh/gitops-runtime:0.24.0 ``` -------------------------------- ### Verify Engine Metrics Collection Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/kb/articles/upgrade-deprecated-docker-images.md After installation, run a build on the Runtime and check Grafana for 'codefresh_' metrics to ensure proper collection. This helps confirm the monitoring setup is working. ```bash # No code provided, instructions are textual. ``` -------------------------------- ### Use Slack Notifier Plugin in Pipeline Hook Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/pipelines/hooks.md Example of a pipeline hook using the `slack-notifier` step to send a notification when a pipeline starts. Ensure the `SLACK_WEBHOOK_URL` environment variable is configured. ```yaml hooks: on_elected: exec: steps: slack_pending: type: slack-notifier:0.0.8 arguments: SLACK_HOOK_URL: '${{SLACK_WEBHOOK_URL}}' SLACK_TEXT: '*Build Started* now' ``` -------------------------------- ### Full Google Cloud Builder Example Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/integrations/gcloud-builder.md This example demonstrates a comprehensive configuration for a build step using the Google Cloud Builder provider, showcasing various options like tags, metadata, build arguments, and detailed provider arguments. ```yaml GCBuild: type: build image_name: '${{IMAGE_NAME}}' working_directory: ${{CloneStep}} tag: your-tag1 tags: - your-tag2 - your-tag3 target: 'test' no_cf_cache: false metadata: set: - qa: pending build_arguments: - WORD=Hello registry: 'reg-integration-name' dockerfile: content: |- FROM alpine as test RUN apk add skopeo ARG WORD RUN echo $WORD provider: type: gcb arguments: google_app_creds: '${{G_CREDS_B64}}' cache: repo: "repositoryname/kaniko-cache" ttl: "10h" timeout: "600s" machineType: 'N1_HIGHCPU_8' logsBucket: "gs://your-project_cloudbuild/logs" diskSizeGb: 10 ``` -------------------------------- ### Install GitOps Runtime using Terraform Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/gitops/runtime-install-with-existing-argo-cd.md Deploy the GitOps Runtime using the Helm provider in Terraform. Ensure unique names for each Runtime and provide necessary account and token details. This example is for tunnel-based access. ```hcl resource "helm_release" "my_gitops_runtime" { name = "my-codefresh-runtime" repository = "oci://quay.io/codefresh" chart = "gitops-runtime" namespace = "my-codefresh-runtime" version = "0.2.14" create_namespace = true set { name = "global.codefresh.accountId" value = var.cf_account_id } set { name = "global.codefresh.userToken.token" value = var.cf_token } set { name = "global.runtime.name" value = "from-terraform" } } ``` -------------------------------- ### Dockerfile to Avoid: Including SonarQube Analysis Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/ci-cd-guides/building-docker-images.md This Dockerfile is an example to avoid because it includes SonarQube analysis, making it dependent on an external SonarQube installation and requiring extra credentials. This couples build logic with CI/CD tasks. ```docker FROM newtmitch/sonar-scanner AS sonar COPY src src RUN sonar-scanner FROM node:11 AS build WORKDIR /usr/src/app COPY . . RUN yarn install \ yarn run lint \ yarn run build \ yarn run generate-docs ``` -------------------------------- ### Example: Keyless Signing in Build Step Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/pipelines/steps/build.md An example of a `build` step configuration that includes the `cosign: sign: true` attribute for enabling keyless signing. ```yaml scenario_multiplatform_keyless_sign: type: "build" stage: "multiplatform-keyless" image_name: ${{PUBLIC_IMAGE_NAME}} tag: "${{CF_BRANCH_TAG_NORMALIZED}}-scenario_multiplatform_keyless_sign" ... cosign: sign: true ... ``` -------------------------------- ### Running Tests with npm Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/example-catalog/ci-examples/codacy-testing.md Use a 'freestyle' step to execute tests. This example uses a Node.js image to install Jest and run tests via npm. Adapt the commands to match your project's test suite. ```yaml tests: title: "Running test" type: "freestyle" working_directory: '${{clone}}' arguments: image: 'node:15.2' commands: - "npm install --save-dev jest" - "npm run test" stage: "test" ``` -------------------------------- ### Register Git Integration Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/gitops/runtime-ingress-configuration.md Use these commands to manually create and register Git integrations if the automatic installation fails, for example, due to DNS record timing issues. Replace placeholders with your specific runtime name and API URL/token. ```bash cf integration git add default --runtime --api-url ``` ```bash cf integration git register default --runtime --token ``` -------------------------------- ### Prepare Backup Directory Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/installation-options/on-premises/codefresh-on-prem-upgrade.md Create a directory for backup files and navigate into it. Ensure the directory has write permissions for other users. ```shell mkdir psqlbackup chmod o+w psqlbackup cd psqlbackup ``` -------------------------------- ### Install Monitoring Component After Runner Install Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/runner/install-codefresh-runner.md Install the monitoring component separately if you skipped cluster integration during Runner installation. Ensure you provide the correct Kubernetes context, namespace, cluster name, and authentication token. ```shell codefresh install monitor --kube-context-name --kube-namespace --cluster-id --token ``` -------------------------------- ### Codefresh Runner Initialization with values-example.yaml Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/runner/install-codefresh-runner.md Installs the Codefresh Runner using a values file, configuring Azure Disk storage. ```yaml Storage: Backend: azuredisk VolumeProvisioner: MountAzureJson: true ``` ```shell codefresh runner init --values values-example.yaml ``` -------------------------------- ### Install Runtime Environment Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/runner/install-codefresh-runner.md Install a runtime environment within the specified Kubernetes namespace. The runtime name will be printed after successful installation. ```shell codefresh install runtime --runtime-kube-namespace codefresh-runtime-1 ``` -------------------------------- ### Install Codefresh CLI Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/runner/install-codefresh-runner.md Installs the Codefresh CLI globally using npm. This is a prerequisite for using the CLI wizard to install the Codefresh Runner. ```shell npm install -g codefresh ``` -------------------------------- ### Install Application with Helm Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/ci-cd-guides/environment-deployments.md Clone the application's Helm chart and install it on each environment's namespace using environment-specific values files. ```bash git clone https://github.com/codefresh-contrib/helm-promotion-sample-app.git cd helm-promotion-sample-app/chart helm install example-qa sample-app -n qa -f values-qa.yaml helm install example-staging sample-app -n staging -f values-staging.yaml helm install example-prod sample-app -n production -f values-prod.yaml ``` -------------------------------- ### Install GitOps Runtime on-premises with Helm Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/gitops/on-prem-gitops-runtime-install.md Use this Helm command to install the GitOps Runtime in your on-premises environment. Ensure you replace placeholders like , , and with your specific values. The namespace and runtime name can also be customized. ```bash helm upgrade --install cf-gitops-runtime \ --create-namespace \ --namespace codefresh \ --set global.codefresh.userToken.token= \ --set global.runtime.name=codefresh \ --set global.codefresh.url= \ --set app-proxy.config.cors= \ --set global.runtime.ingress.enabled="true" \ --set "global.runtime.ingress.hosts[0]"= \ cf-gitops-runtime/gitops-runtime ``` -------------------------------- ### Install Codefresh Agent Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/runner/install-codefresh-runner.md Install the Codefresh agent into the specified namespace. You will need to note down the token generated in the first step for the subsequent installation command. ```shell codefresh create agent $NAME codefresh install agent --token $TOKEN --kube-namespace codefresh-agent codefresh get agents ``` -------------------------------- ### Install App-Proxy Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/runner/install-codefresh-runner.md Install the App-Proxy component on a Kubernetes cluster that already has the Codefresh Runner installed. Replace '' with your ingress controller's hostname. ```shell codefresh install app-proxy --host= ``` -------------------------------- ### Run Documentation with Docker Compose Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/README.md Use this command to preview documentation locally with Docker. Ensure Docker Desktop is installed. ```bash docker compose up ``` -------------------------------- ### Disable global validation via Helm install command Source: https://github.com/codefresh-io/docs.codefresh.io/blob/master/_docs/installation/gitops/gitops-values-yaml-validation.md Use this flag with the Helm install command to disable automated validation for all installation settings. ```bash --set installer.skipValidation=true ```