github-action-atmos-component-updater
This is GitHub Action that can be used as a workflow for automatic updates via Pull Requests in your infrastructure repository according to versions in components sources.
This project is part of our comprehensive "SweetOps" approach towards DevOps.
It's 100% Open Source and licensed under the APACHE2.
Introduction
This is GitHub Action that can be used as a workflow for automatic updates via Pull Requests in your infrastructure repository according to versions in components sources.
Key Features:
- Selective Component Processing: Configure the action to
exclude
orinclude
specific components using wildcards, ensuring that only relevant updates are processed. - PR Management: Limit the number of PRs opened at a time, making it easier to manage large-scale updates without overwhelming the system. Automatically close old component-update PRs, so they don't pile up.
- Material Changes Focus: Automatically open pull requests only for components with significant changes, skipping minor updates to
component.yaml
files to reduce unnecessary PRs and maintain a streamlined system. - Informative PRs: Link PRs to release notes for new components, providing easy access to relevant information, and use consistent naming for easy tracking.
- Scheduled Updates: Run the action on a cron schedule tailored to your organization's needs, ensuring regular and efficient updates.
Usage
Prerequisites
This GitHub Action once used in workflow needs permissions to create/update branches and open/close pull requests so the access token needs to be passed.
It can be done in two ways:
- create a dedicated Personal Access Token (PAT)
- use
GITHUB_TOKEN
If you would like to use GITHUB_TOKEN
make sure to set permissions in the workflow as follow:
permissions:
- contents: write
- pull-requests: write
Also, make sure that you set to Allow GitHub Actions to create and approve pull requests
on both organization and repository levels:
https://github.com/organizations/YOUR-ORG/settings/actions
https://github.com/YOUR-ORG/YOUR-REPO/settings/actions
Workflow example
name: "atmos-components"
on:
workflow_dispatch: {}
schedule:
- cron: '0 8 * * 1' # Execute every week on Monday at 08:00
permissions:
contents: write
pull-requests: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Update Atmos Components
uses: cloudposse/github-action-atmos-component-updater@v2
with:
github-access-token: ${{ secrets.GITHUB_TOKEN }}
max-number-of-prs: 5
include: |
aws-*
eks/*
bastion
exclude: aws-sso,aws-saml
atmos.yaml
)
Using a Custom Atmos CLI Config Path (If your atmos.yaml
file is not located in the root of the infrastructure repository, you can specify the path to it using ATMOS_CLI_CONFIG_PATH
env variable.
# ...
- name: Update Atmos Components
uses: cloudposse/github-action-atmos-component-updater@v2
env:
# Directory containing the `atmos.yaml` file
ATMOS_CLI_CONFIG_PATH: ${{ github.workspace }}/rootfs/usr/local/etc/atmos/
with:
github-access-token: ${{ secrets.GITHUB_TOKEN }}
max-number-of-prs: 5
Customize Pull Request labels, title and body
# ...
- name: Update Atmos Components
uses: cloudposse/github-action-atmos-component-updater@v2
with:
github-access-token: ${{ secrets.GITHUB_TOKEN }}
max-number-of-prs: 5
pr-title: 'Update Atmos Component \`{{ component_name }}\` to {{ new_version }}'
pr-body: |
## what
Component \`{{ component_name }}\` was updated [{{ old_version }}]({{ old_version_link }}) → [{{ old_version }}]({{ old_version_link }}).
## references
- [{{ source_name }}]({{ source_link }})
pr-labels: |
component-update
automated
atmos
IMPORTANT: The backtick symbols must be escaped in the GitHub Action parameters. This is because GitHub evaluates whatever is in the backticks and it will render as an empty string.
title
template these placeholders are available:
For component_name
source_name
old_version
new_version
body
template these placeholders are available:
For component_name
source_name
source_link
old_version
new_version
old_version_link
new_version_link
old_component_release_link
new_component_release_link
Inputs
Name | Description | Default | Required |
---|---|---|---|
atmos-version | Atmos version to use for vendoring. Default 'latest' | latest | false |
dry-run | Skip creation of remote branches and pull requests. Only print list of affected componented into file that is defined in 'outputs.affected-components-file' | false | false |
exclude | Comma or new line separated list of component names to exclude. For example: 'vpc,eks/*,rds'. By default no components are excluded. Default '' | false | |
github-access-token | GitHub Token used to perform git and GitHub operations | ${{ github.token }} | false |
include | Comma or new line separated list of component names to include. For example: 'vpc,eks/*,rds'. By default all components are included. Default '*' | * | false |
infra-terraform-dirs | Comma or new line separated list of terraform directories in infra repo. For example 'components/terraform,components/terraform-old. Default 'components/terraform' | components/terraform | false |
log-level | Log level for this action. Default 'INFO' | INFO | false |
max-number-of-prs | Number of PRs to create. Maximum is 10. | 10 | false |
pr-body-template | A string representing a Jinja2 formatted template to be used as the content of a Pull Request (PR) body. If not set template from src/templates/pr\_body.j2.md will be used |
false | |
pr-labels | Comma or new line separated list of labels that will added on PR creation. Default: component-update |
component-update | false |
pr-title-template | A string representing a Jinja2 formatted template to be used as the content of a Pull Request (PR) title. If not, set template from src/templates/pr\_title.j2.md will be used |
false | |
vendoring-enabled | Do not perform 'atmos vendor component-name' on components that wasn't vendored | true | false |
Outputs
Name | Description |
---|---|
affected | The affected components |
has-affected-stacks | Whether there are affected components |
Share the Love
Like this project? Please give it a ★ on our GitHub! (it helps us a lot)
Are you using this project or any of our other projects? Consider leaving a testimonial. =)
Related Projects
Check out these related projects.
References
For additional context, refer to some of these links.
- github-actions-workflows - Reusable workflows for different types of projects
- example-github-action-release-workflow - Example application with complicated release workflow
Help
Got a question? We got answers.
File a GitHub issue, send us an email or join our Slack Community.
DevOps Accelerator for Startups
We are a DevOps Accelerator. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.
Work directly with our team of DevOps experts via email, slack, and video conferencing.
We deliver 10x the value for a fraction of the cost of a full-time engineer. Our track record is not even funny. If you want things done right and you need it done FAST, then we're your best bet.
- Reference Architecture. You'll get everything you need from the ground up built using 100% infrastructure as code.
- Release Engineering. You'll have end-to-end CI/CD with unlimited staging environments.
- Site Reliability Engineering. You'll have total visibility into your apps and microservices.
- Security Baseline. You'll have built-in governance with accountability and audit logs for all changes.
- GitOps. You'll be able to operate your infrastructure via Pull Requests.
- Training. You'll receive hands-on training so your team can operate what we build.
- Questions. You'll have a direct line of communication between our teams via a Shared Slack channel.
- Troubleshooting. You'll get help to triage when things aren't working.
- Code Reviews. You'll receive constructive feedback on Pull Requests.
- Bug Fixes. We'll rapidly work with you to fix any bugs in our projects.
Slack Community
Join our Open Source Community on Slack. It's FREE for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally sweet infrastructure.
Discourse Forums
Participate in our Discourse Forums. Here you'll find answers to commonly asked questions. Most questions will be related to the enormous number of projects we support on our GitHub. Come here to collaborate on answers, find solutions, and get ideas about the products and services we value. It only takes a minute to get started! Just sign in with SSO using your GitHub account.
Newsletter
Sign up for our newsletter that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.
Office Hours
Join us every Wednesday via Zoom for our weekly "Lunch & Learn" sessions. It's FREE for everyone!
Contributing
Bug Reports & Feature Requests
Please use the issue tracker to report any bugs or file feature requests.
Developing
If you are interested in being a contributor and want to get involved in developing this project or help out with our other projects, we would love to hear from you! Shoot us an email.
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull Request so that we can review your changes
NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!
Copyright
Copyright © 2017-2023 Cloud Posse, LLC
License
See LICENSE for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Trademarks
All other trademarks referenced herein are the property of their respective owners.
About
This project is maintained and funded by Cloud Posse, LLC. Like it? Please let us know by leaving a testimonial!
We're a DevOps Professional Services company based in Los Angeles, CA. We ❤️ Open Source Software.
We offer paid support on all of our projects.
Check out our other projects, follow us on twitter, apply for a job, or hire us to help with your cloud strategy and implementation.
Contributors
Zinovii Dmytriv |
Erik Osterman |
---|