Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update github actions documentation #606

Merged
merged 8 commits into from
Jun 6, 2024
Merged

Conversation

goruha
Copy link
Member

@goruha goruha commented May 23, 2024

what

  • Update github actions documentation

why

  • Document the latest gitops

references

  • DEV-491: Update Atmos.tools documentation for GitHub Actions to use atmos.yaml

Comment on lines 40 to 64
The action expects the atmos configuration file `atmos.yaml` to be present in the repository.
The config should have the following structure:

```yaml
# .github/workflows/atmos-terraform-apply.yaml
name: "atmos-terraform-apply"

on:
workflow_dispatch:
pull_request:
types:
- closed
branches:
- main

# These permissions are required for GitHub to assume roles in AWS
permissions:
id-token: write
contents: read

jobs:
apply:
runs-on: ubuntu-latest
steps:
- name: Terraform Apply
uses: cloudposse/github-action-atmos-terraform-apply@v2
with:
component: "foobar"
stack: "plat-ue2-sandbox"
# ./rootfs/usr/local/etc/atmos/atmos.yaml
integrations:
github:
gitops:
terraform-version: 1.5.2
infracost-enabled: false
artifact-storage:
region: us-east-2
bucket: cptest-core-ue2-auto-gitops
table: cptest-core-ue2-auto-gitops-plan-storage
role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha
role:
plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
matrix:
sort-by: .stack_slug
group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-")
```

with the following configuration as an example:
> [!IMPORTANT]
> **Please note!** This GitHub Action only works with `atmos >= 1.63.0`. If you are using `atmos < 1.63.0` please use [`v1` version](https://github.com/cloudposse/github-action-atmos-terraform-plan/tree/v1).
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is all copy and pasted from affected-stacks.md above. Rather than having the same steps on both of these pages, can we create a new page for requirements and then link both these 2 pages to that new page?

That page could also be used for this ticket: https://linear.app/cloudposse/issue/DEV-1693/document-atmos-plan-storage-action-on-atmostools

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goruha please see this conversation

Copy link
Sponsor Member

@milldr milldr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see comments and consider consolidating setup / config requirements into a single page rather than copy and pasting across each

stack: "plat-ue2-sandbox"
sha: ${{ github.sha }}
atmos-config-path: ./rootfs/usr/local/etc/atmos/
atmos-version: 1.63.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I believe we should consider moving this into the atmos.yaml for a few reasons:

  • Ensure GitHub Actions and local execution use the same version
  • Make it optional
  • It's error prone and easily missed. See this thread in SweetOps

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we support a version parameter, I think it doesn't belong in the integrations section, but more of a top-level section. Let's discuss with @aknysh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can create a separate section for it. Let's discuss

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osterman

We can not move into atmos.yaml

atmos-config-path: ./rootfs/usr/local/etc/atmos/
atmos-version: 1.63.0

Because this setting is required by GitHub action to install Atmos and get gitops settings from atmos.yml config

* master:
  Update `atmos validate stacks` command (#611)
  Add Atmos manifest lists merge strategies (#609)
  Improve `atmos validate stacks` and `atmos describe affected` commands (#608)
  Use Darker Theme, Add File Component (#607)
  Update Atmos logs. Update docs (#605)
Comment on lines +51 to +72
# This job is an example how to use the affected stacks with the matrix strategy
atmos-plan:
needs: ["atmos-affected"]
if: ${{ needs.atmos-affected.outputs.has-affected-stacks == 'true' }}
name: ${{ matrix.stack_slug }}
runs-on: ['self-hosted']
strategy:
max-parallel: 10
fail-fast: false # Don't fail fast to avoid locking TF State
matrix: ${{ fromJson(needs.atmos-affected.outputs.matrix) }}
## Avoid running the same stack in parallel mode (from different workflows)
concurrency:
group: ${{ matrix.stack_slug }}
cancel-in-progress: false
steps:
- name: Plan Atmos Component
uses: cloudposse/github-action-atmos-terraform-plan@v2
with:
component: ${{ matrix.component }}
stack: ${{ matrix.stack }}
atmos-config-path: ./rootfs/usr/local/etc/atmos/
atmos-version: 1.63.0
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove all of this, since this page is for "affected-stacks"

Suggested change
# This job is an example how to use the affected stacks with the matrix strategy
atmos-plan:
needs: ["atmos-affected"]
if: ${{ needs.atmos-affected.outputs.has-affected-stacks == 'true' }}
name: ${{ matrix.stack_slug }}
runs-on: ['self-hosted']
strategy:
max-parallel: 10
fail-fast: false # Don't fail fast to avoid locking TF State
matrix: ${{ fromJson(needs.atmos-affected.outputs.matrix) }}
## Avoid running the same stack in parallel mode (from different workflows)
concurrency:
group: ${{ matrix.stack_slug }}
cancel-in-progress: false
steps:
- name: Plan Atmos Component
uses: cloudposse/github-action-atmos-terraform-plan@v2
with:
component: ${{ matrix.component }}
stack: ${{ matrix.stack }}
atmos-config-path: ./rootfs/usr/local/etc/atmos/
atmos-version: 1.63.0

milldr
milldr previously approved these changes Jun 4, 2024
@goruha goruha merged commit 4ea538d into main Jun 6, 2024
14 checks passed
@goruha goruha deleted the update-github-integration-docs branch June 6, 2024 16:07
Copy link

github-actions bot commented Jun 8, 2024

These changes were released in v1.79.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants