- Notifications
You must be signed in to change notification settings - Fork27
GitHub action with ability to run codefresh pipeline
License
codefresh-io/codefresh-pipeline-runner
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Codefresh is a CI/CD platform that engineers actually love to use. TheCodefresh pipeline runner GitHub action will trigger an existing Codefresh pipeline from a GitHub action. Codefresh pipelines can be used to build applications, run tests, deploy to Kubernetes, run canary or blue/gree deployments, deploy serverless functions, really just about everything while tying all deployments back to their commits, authors, and contributors.
It is based on theCodefresh CLI which can execute Codefresh pipelines remotely (using an API key for authentication). The Codefresh CLI is already available as apublic Docker image, so creating a GitHub action with it is a trivial process.
GitHub actions are a flexible way to respond to GitHub events and perform one or more taskswhen a specific GitHub event happens. GitHub actions can also use Codefresh pipelines as a back-endresulting in a very powerful combination where the first action starts from GitHub, but Codefresh takes careof the actual compilation or deployment in a pipeline.
Make sure that you have
- a GitHub account with Actions enabled
- aCodefresh account with one or more existing pipelines ready
- aCodefresh API token that will be used as a secret in the GitHub action
The GitHub workflow is placed on thepush event and therefore starts whenever a Git commit happens. The Workflow has a single action that starts the Codefresh pipeline runner.
The pipeline runner is a Docker image with the Codefresh CLI. It uses the Codefresh API token to authenticate to Codefresh and then calls a an existing pipeline via its trigger.
The result is that all the details from the Git push (i.e. the GIT hash) are transferred to the Codefresh pipeline that gets triggered remotely
In order to use the GitHub action, fork this repository and then navigate to the "Actions" tab in GitHub. Click on the "View main.workflow" button on the right hand side. Make sure that an actual branch is selected on the top left of the window. Then click the "Edit this file" button in the main workarea (exactly as you would edit a normal git file via GitHub)
Select the pipeline runner action and click the "Edit" button. On the right side panel enter the following
- A secret with name
CF_API_KEYand value your Codefresh API token (https://codefresh.io/docs/docs/integrations/codefresh-api/#authentication-instructions ) - An environment variable called
PIPELINE_NAMEwith a value of<project_name>/<pipeline_name> - An optional environment variable called
TRIGGER_NAMEwith trigger name attached to this pipeline. See thetriggers section for more information
Click the Done button to save your changes and commit.
Now next time you commit anything in your GitHub repository the Codefresh pipeline will also execute.
The action will report if the pipeline execution was successful. For example, if your pipeline has unit tests that fail, by default, it will report the action failed. The logs from the pipeline will be streamed into the Github action console.
Running a Codefresh pipeline to compile, test, docker build, and deploy to kubernetes
name: 'Codefresh pipeline runner'description: 'GitHub action that run codefresh pipeline'author: 'codefresh'branding: icon: 'arrow-right-circle' color: 'green'runs: using: 'docker' image: 'Dockerfile'An example of workflow
version: 1.0on: push: branches: - masterjobs: build: steps: - name: 'run pipeline' uses: ./ with: PIPELINE_NAME: 'codefresh-pipeline' TRIGGER_NAME: 'codefresh-trigger' id: run-pipelineAbout
GitHub action with ability to run codefresh pipeline
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.