All Projects β†’ werf β†’ actions

werf / actions

Licence: Apache-2.0 license
Set of actions for implementing CI/CD with werf and GitHub Actions

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to actions

Werf
The CLI tool gluing Git, Docker, Helm, and Kubernetes with any CI system to implement CI/CD and Giterminism
Stars: ✭ 2,814 (+4100%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd, gitops, werf
Android-CICD
This repo demonstrates how to work on CI/CD for Mobile Apps πŸ“± using Github Actions πŸ’Š + Firebase Distribution πŸŽ‰
Stars: ✭ 37 (-44.78%)
Mutual labels:  continuous-integration, continuous-delivery, actions, ci-cd, github-actions
changed-files
Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
Stars: ✭ 733 (+994.03%)
Mutual labels:  continuous-integration, actions, ci-cd, github-actions
bump-everywhere
πŸš€ Automate versioning, changelog creation, README updates and GitHub releases using GitHub Actions,npm, docker or bash.
Stars: ✭ 24 (-64.18%)
Mutual labels:  continuous-integration, continuous-delivery, gitops, github-actions
Cml
♾️ CML - Continuous Machine Learning | CI/CD for ML
Stars: ✭ 2,843 (+4143.28%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd, github-actions
actions
Our Library of GitHub Actions
Stars: ✭ 49 (-26.87%)
Mutual labels:  actions, ci-cd, github-actions
Concourse
Concourse is a container-based continuous thing-doer written in Go.
Stars: ✭ 6,070 (+8959.7%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd
action-homebrew-bump-formula
βš™οΈ A GitHub Action to easily bump Homebrew formula on new release
Stars: ✭ 68 (+1.49%)
Mutual labels:  actions, action, github-actions
Git Push Deploy
Simple Automated CI/CD Pipeline for GitHub and GitLab Projects
Stars: ✭ 21 (-68.66%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd
Ccmenu
CCMenu is a Mac application to monitor continuous integration servers.
Stars: ✭ 306 (+356.72%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd
Agola
Agola: CI/CD Redefined
Stars: ✭ 783 (+1068.66%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd
Cyclone
Powerful workflow engine and end-to-end pipeline solutions implemented with native Kubernetes resources. https://cyclone.dev
Stars: ✭ 978 (+1359.7%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd
Drone
Drone is a Container-Native, Continuous Delivery Platform
Stars: ✭ 24,287 (+36149.25%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd
Gaia
Build powerful pipelines in any programming language.
Stars: ✭ 4,534 (+6667.16%)
Mutual labels:  continuous-integration, continuous-delivery, gitops
Gocd
Main repository for GoCD - Continuous Delivery server
Stars: ✭ 6,314 (+9323.88%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd
Jx
Jenkins X provides automated CI+CD for Kubernetes with Preview Environments on Pull Requests using Cloud Native pipelines from Tekton
Stars: ✭ 4,041 (+5931.34%)
Mutual labels:  continuous-integration, continuous-delivery, gitops
Screwdriver
An open source build platform designed for continuous delivery.
Stars: ✭ 870 (+1198.51%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd
Kontinuous
The Kubernetes Continuous Integration & Delivery Platform (CI/CD) πŸ”„
Stars: ✭ 115 (+71.64%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd
Fabric8 Platform
Generates the distribution of the fabric8 microservices platform
Stars: ✭ 105 (+56.72%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd
Fabric8
fabric8 is an open source microservices platform based on Docker, Kubernetes and Jenkins
Stars: ✭ 1,783 (+2561.19%)
Mutual labels:  continuous-integration, continuous-delivery, ci-cd

___

This action set allows you to organize CI/CD with GitHub Actions and werf. The set consists of several independent and complex actions:

Each action combines all the necessary steps in itself, and logic may be divided into environment setup and launching the corresponding command.

Ready-to-use GitHub Actions Workflows for different CI/CD workflows are available here.

Also, there is another action β€” werf/actions/install. With this action, the user can install werf and use binary within job steps for own purposes.

Versioning

When using actions, select the version corresponding to the required MAJOR.MINOR version of werf:

# Run converge using actual werf version within 1.1 alpha channel.
- uses: werf/actions/[email protected]

# Run converge using actual werf version within 1.2 alpha channel.
- uses: werf/actions/[email protected]

Environment setup in details

werf binary installation

By default, all actions install actual werf version within 1.2 alpha channel (more details about channels, werf release cycle and compatibility promise here). Using the channel input the user can switch the release channel.

This is recommended approach to be up-to-date and to use actual werf version without changing configurations.

- uses: werf/actions/[email protected]
  with:
    channel: alpha

Withal, it is not necessary to work within release channels, and the user might specify certain werf version with version input.

- uses: werf/actions/[email protected]
  with:
    version: v1.2.9

werf ci-env

This is the step where an action:

  • sets the defaults for werf command options based on GitHub Workflow environment variables (e.g. container repository address to the WERF_REPO environment variable using the following pattern: ghcr.io/$GITHUB_REPOSITORY/<project-from-werf.yaml>).
  • performs docker login to ghcr.io using the github-token input (only if ghcr.io used as WERF_REPO).

The github-token input is optional, and the input is there in case you need to use a non-default token. By default, an action will use the token provided to your workflow.

kubeconfig setup (optional)

The kubeconfig may be used for deployment, cleanup, distributed locks and caches. Thus, the configuration should be added before step with the action or passed as base64 encoded data with kube-config-base64-data input:

  • Prepare kubeconfig (e.g. cat ~/.kube/config | base64) and save in GitHub Secrets (e.g. with name KUBE_CONFIG_BASE64_DATA).

  • Pass secret with kube-config-base64-data input:

    - uses: werf/actions/[email protected]
      with:
        kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}

Working with werf options

All werf options can be defined with environment variables:

- uses: werf/actions/[email protected]
  env:
    WERF_LOG_VERBOSE: "on" # The same as using the option --log-verbose=on.

Working with container registry

Default container repository

An action generates the default container repository address and performs docker login to the registry within werf ci-env step.

For cleanup action, the user needs to create personal access token with read:packages and delete:packages scope and uses it as the WERF_REPO_GITHUB_TOKEN environment variable or the github-token input. It is recommended to store the token as a secret.

- uses: werf/actions/[email protected]
  with:
    kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
  env:
    WERF_REPO_GITHUB_TOKEN: ${{ secrets.WERF_CLEANUP_PAM }}

Custom container repository

An arbitrary container repository can be specified with the WERF_REPO and WERF_REPO_CONTAINER_REGISTRY environment variables. For instance, steps for GCR:

- name: Login to GCR
  uses: docker/login-action@v1
  with:
    registry: gcr.io
    username: _json_key
    password: ${{ secrets.GCR_JSON_KEY }}
    
- uses: werf/actions/[email protected]
  env:
    WERF_REPO: "gcr.io/company/app"
    WERF_REPO_CONTAINER_REGISTRY: "gcr"

To learn more about how to work with the different container registries, see the appropriate article in the werf documentation.

Examples

converge

converge:
  name: Converge
  runs-on: ubuntu-latest
  steps:

    - name: Checkout code
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: Converge
      uses: werf/actions/[email protected]
      with:
        env: production
        kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}

dismiss

dismiss: 
  name: Dismiss
  runs-on: ubuntu-latest
  steps:
  
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Dismiss
      uses: werf/actions/[email protected]
      with:
        kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
        env: production

run

run: 
  name: Run
  runs-on: ubuntu-latest
  steps:
  
    - name: Checkout code
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: Run
      uses: werf/actions/[email protected]
      with:
        image: backend
        args: rails server
        kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
      env:
        WERF_DOCKER_OPTIONS: "-d -p 3000:3000"

cleanup

cleanup: 
  name: Cleanup
  runs-on: ubuntu-latest
  steps:
  
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Fetch all history for all tags and branches
      run: git fetch --prune --unshallow

    - name: Cleanup
      uses: werf/actions/[email protected]
      with:
        kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
      env:
        WERF_REPO_GITHUB_TOKEN: ${{ secrets.WERF_CLEANUP_PAM }}

install

werf:
  name: werf 
  runs-on: ubuntu-latest
  steps:
  
    - name: Checkout code  
      uses: actions/checkout@v2

    - name: Install werf CLI  
      uses: werf/actions/[email protected]
    
    # For deploy and distributed locks.
    - name: Create kube config
      run: |
        KUBECONFIG=$(mktemp -d)/config
        base64 -d <(printf "%s" $KUBE_CONFIG_BASE64_DATA) > $KUBECONFIG
        echo KUBECONFIG=$KUBECONFIG >> $GITHUB_ENV
      env:
        KUBE_CONFIG_BASE64_DATA: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
  
    - name: Run werf commands
      run: |
        source $(werf ci-env github --as-file)
        werf render
        werf converge
      env:
        GITHUB_TOKEN: ${{ github.token }}
        WERF_ENV: production

FAQ

werf always rebuilds images on new commit

Make sure to use fetch-depth: 0 setting in the checkout action, like follows:

- name: Checkout code
  uses: actions/checkout@v2
  with:
    fetch-depth: 0

By default fetch-depth set to 1 which disables git history when checking out code. werf cache selection algorithm uses git history to determine whether some image bound to some commit could be used as a cache when building current commit (current commit should be descendant to the cache commit).

Setting fetch-depth to 0 enables full fetch of git history and it is a recommended approach. It is also possible to limit fetch history with some decent number of commits, which would enable images caching limited to that number of commits, but this would have a negative impact on cache reproducibility.

License

Apache License 2.0, see LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].