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

ci: Update git-xargs-test branch from delivery-github-repo-management #6

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BUILD_HARNESS_REPO=ghcr.io/defenseunicorns/build-harness/build-harness
# renovate: datasource=github-tags depName=defenseunicorns/build-harness
BUILD_HARNESS_VERSION=2.0.3
BUILD_HARNESS_VERSION=2.0.4
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/general_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: General Issue
about: Suggest a new feature, report a bug, or just ask a question
title: ''
labels: ''
assignees: ''

---

<!-- Thank you for submitting an issue! Please answer the following questions. This template is intended to guide the issue author toward meeting our [Definition of Ready](https://github.com/defenseunicorns/delivery-aws-iac/blob/main/CONTRIBUTING.md#definition-of-ready-for-a-backlog-item). You don't have to use this exact format if you don't want to, but whatever you submit must meet the DoR or the issue may be closed, and you will be asked to resubmit. -->

### Persona

<!-- Who is submitting this request? Please describe how you use this repo. -->



### Description

<!-- What **outcome** is being requested? Note: An outcome is a description of the behavior desired rather than an imperative. For example, "I want to be able to create a new user" is an outcome, while "Create new users using this specific javascript library" is an imperative. -->



### Use Case

<!-- Why is this needed? Is this request related to a problem? Please describe. -->



### Impact

<!-- What will happen if this request is not fulfilled? -->



### Completion

<!-- What does being "done" look like?
Note: Some "givens" of done criteria that don't need to be included in the answer:
> * The change has been peer reviewed
> * Automated tests have been written and/or updated, and are passing
> * Documentation has been written and/or updated -->



### Additional Context

<!-- Any additional information / visual aids that might be helpful in understanding the request? -->
25 changes: 25 additions & 0 deletions .github/workflows/pr-merge-group.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# triggers on merge_group and pull_request events
# only use this if merge queue is enabled, otherwise stick to test-command for e2e testing

name: pr-merge-group
on:
merge_group:
types: [checks_requested]
pull_request:

defaults:
run:
shell: bash -eo pipefail {0}

permissions:
id-token: write # needed for oidc auth for AWS creds
contents: read

jobs:
pr-merge-group-test:
uses: defenseunicorns/delivery-github-actions-workflows/.github/workflows/pr-merge-group-test.yml@main
secrets:
APPLICATION_ID: ${{ secrets.NARWHAL_BOT_APP_ID }}
APPLICATION_PRIVATE_KEY: ${{ secrets.NARWHAL_BOT_SECRET }}
AWS_COMMERCIAL_ROLE_TO_ASSUME: ${{ secrets.NARWHAL_AWS_COMMERCIAL_ROLE_TO_ASSUME }}
AWS_GOVCLOUD_ROLE_TO_ASSUME: ${{ secrets.NARWHAL_AWS_GOVCLOUD_ROLE_TO_ASSUME }}
20 changes: 20 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# If the workflow trigger is "pull_request", run pre-commit checks.
name: pre-commit

on:
pull_request:
merge_group:
workflow_dispatch:


permissions:
pull-requests: write
id-token: write
contents: read

jobs:
pre-commit:
uses: defenseunicorns/delivery-github-actions-workflows/.github/workflows/pre-commit.yml@main
secrets:
APPLICATION_ID: ${{ secrets.NARWHAL_BOT_APP_ID }}
APPLICATION_PRIVATE_KEY: ${{ secrets.NARWHAL_BOT_SECRET }}
40 changes: 40 additions & 0 deletions .github/workflows/pull-request-opened-by-renovate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# If Renovate is not the author of the PR that triggers this workflow, it will do nothing.
# If Renovate is the author of the PR that triggers this workflow, but the workflow event is anything but "opened", it will do nothing.
# If Renovate is the author of the PR that triggers this workflow, and the workflow event is "opened", it will:
# 1. Autoformat using pre-commit and, if necessary, push an additional commit to the PR with the autoformat fixes.
# 2. Change the branch protection rules to turn off require codeowner approval due to github apps not being able to be codeowners or added to teams.
# 3. narwhal-bot approves the PR.
# 4. narwhal-bot merges the PR.
# 5. PR is added to merge queue.
# 6. tests are ran.
# a. If tests pass, PR is merged.
# i. If PR is merged, it is closed and branch is deleted.
# b. If tests fail, PR stays open and it is removed from merge queue.
# 7. Branch protection is always set back to the original state.
#
# See ADR #0008.
name: auto-test
on:
pull_request:
# WARNING: DO NOT ADD MORE EVENT TYPES HERE! Because this workflow will push a new commit to the PR in the Autoformat step, adding more event types may cause an infinite loop.
types:
- opened

permissions:
id-token: write
contents: write

defaults:
run:
# We need -e -o pipefail for consistency with GitHub Actions' default behavior
shell: bash -e -o pipefail {0}

jobs:
renovate-test:
if: github.event.client_payload.github.actor == 'renovate[bot]' || github.actor == 'renovate[bot]'
uses: defenseunicorns/delivery-github-actions-workflows/.github/workflows/renovate-test.yml@main
secrets:
APPLICATION_ID: ${{ secrets.NARWHAL_BOT_APP_ID }}
APPLICATION_PRIVATE_KEY: ${{ secrets.NARWHAL_BOT_SECRET }}
AWS_COMMERCIAL_ROLE_TO_ASSUME: ${{ secrets.NARWHAL_AWS_COMMERCIAL_ROLE_TO_ASSUME }}
AWS_GOVCLOUD_ROLE_TO_ASSUME: ${{ secrets.NARWHAL_AWS_GOVCLOUD_ROLE_TO_ASSUME }}
19 changes: 19 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# On every push to main, run release-please to automatically handle the release process.

name: release-please

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
uses: defenseunicorns/delivery-github-actions-workflows/.github/workflows/release-please.yml@main
secrets:
APPLICATION_ID: ${{ secrets.NARWHAL_BOT_APP_ID }}
APPLICATION_PRIVATE_KEY: ${{ secrets.NARWHAL_BOT_SECRET }}
19 changes: 19 additions & 0 deletions .github/workflows/repo-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: repo-config

on:
schedule:
# daily at 11:00 UTC
- cron: '0 11 * * *'

jobs:
repo-config:
uses: defenseunicorns/delivery-github-actions-workflows/.github/workflows/repo-config.yml@main
secrets:
APPLICATION_ID: ${{ secrets.NARWHAL_BOT_APP_ID }}
APPLICATION_PRIVATE_KEY: ${{ secrets.NARWHAL_BOT_SECRET }}
with:
branch: main
checks: |-
checks:
- context: 'e2e-tests'
- context: 'pre-commit-checks'
50 changes: 50 additions & 0 deletions .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# When someone with write access to the repo adds a comment to a PR that contains "/test <command>", dispatch the workflow found in "test-command.yml"
# When someone with write access to the repo adds a comment to a PR that contains "/update <command>", dispatch the workflow found in "update-command.yml"

name: Slash Command Dispatch

on:
issue_comment:
types: [created]

jobs:

slashCommandDispatchTest:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/test')
runs-on: ubuntu-latest
steps:
- name: Get token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v4
with:
application_id: ${{ secrets.NARWHAL_BOT_APP_ID }}
application_private_key: ${{ secrets.NARWHAL_BOT_SECRET }}

- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v4
with:
token: ${{ steps.get_workflow_token.outputs.token }}
reaction-token: ${{ steps.get_workflow_token.outputs.token }}
commands: test
permission: write
issue-type: pull-request

slashCommandDispatchUpdate:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/update')
runs-on: ubuntu-latest
steps:
- name: Get token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v4
with:
application_id: ${{ secrets.NARWHAL_BOT_APP_ID }}
application_private_key: ${{ secrets.NARWHAL_BOT_SECRET }}

- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v4
with:
token: ${{ steps.get_workflow_token.outputs.token }}
reaction-token: ${{ steps.get_workflow_token.outputs.token }}
commands: update
permission: write
issue-type: pull-request
38 changes: 38 additions & 0 deletions .github/workflows/test-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# usage:
# A user with write status to the repo can from a PR comment:

# run a single test
# /test make=<make-target> region=<region>

# run ping test
# /test ping

# run all tests in the makefile
# /test

name: test
on:
repository_dispatch:
types: [test-command]


permissions:
id-token: write
contents: read

defaults:
run:
# We need -e -o pipefail for consistency with GitHub Actions' default behavior
shell: bash -e -o pipefail {0}

jobs:
e2e-test:
uses: defenseunicorns/delivery-github-actions-workflows/.github/workflows/e2e-test.yml@main
secrets:
APPLICATION_ID: ${{ secrets.NARWHAL_BOT_APP_ID }}
APPLICATION_PRIVATE_KEY: ${{ secrets.NARWHAL_BOT_SECRET }}
AWS_COMMERCIAL_ROLE_TO_ASSUME: ${{ secrets.NARWHAL_AWS_COMMERCIAL_ROLE_TO_ASSUME }}
AWS_GOVCLOUD_ROLE_TO_ASSUME: ${{ secrets.NARWHAL_AWS_GOVCLOUD_ROLE_TO_ASSUME }}
with:
# check if the required slash command args are present, if so populate the json matrix, else pass in null and relevant e2e tests that would require a make target and region will be skipped
e2e-test-matrix: ${{ (contains(github.event.client_payload.slash_command_args.named, 'make') && contains(github.event.client_payload.slash_command_args.named, 'region')) && format('[{{"make-target":"{0}", "region":"{1}"}}]', github.event.client_payload.slash_command_args.named.make, github.event.client_payload.slash_command_args.named.region) || null }}
22 changes: 22 additions & 0 deletions .github/workflows/update-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This workflow is triggered by a comment on a pull request. The comment must contain "/update <command>" to trigger the workflow.

name: update
on:
repository_dispatch:
types: [update-command]

permissions:
id-token: write
contents: write

defaults:
run:
# We need -e -o pipefail for consistency with GitHub Actions' default behavior
shell: bash -e -o pipefail {0}

jobs:
update:
uses: defenseunicorns/delivery-github-actions-workflows/.github/workflows/update.yml@main
secrets:
APPLICATION_ID: ${{ secrets.NARWHAL_BOT_APP_ID }}
APPLICATION_PRIVATE_KEY: ${{ secrets.NARWHAL_BOT_SECRET }}
34 changes: 25 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
.idea/
.DS_Store
.vscode
*.
# Local .terraform directories
**/.terraform/*

**/.terraform.lock.hcl

# Local .terraform directories
.terraform/
*.terraform.*
# .tfstate files
*.tfstate
*.tfstate.*

*.terraform.lock.hcl

# Crash log files
crash.log
crash.*.log
Expand All @@ -22,7 +23,12 @@ crash.*.log
# to change depending on the environment.
*.tfvars
*.tfvars.json
!fixtures*.tfvars

# Except ones that we do want to commit because they are used for automated tests
!examples/complete/fixtures.common.tfvars
!examples/complete/fixtures.insecure.tfvars
!examples/complete/fixtures.secure.tfvars
!modules/cloudtrail/examples/complete/fixtures.create-bucket.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
Expand All @@ -34,14 +40,24 @@ override.tf.json
# Include override files you do wish to add to version control using negated pattern
# !example_override.tf

# Ignore Terraform state files
backend.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc

ignore
# Ignore Terraform cache
.terragrunt-cache*

# Ignore Terraform state files
backend.tf

# Ignore Checkov external module downloads
.external_modules

examples/zarf-complete-example/build

#ignore lamba builds json file created from deploying lambda resource

**/ignore
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:
- "--verbose"
- "--allow-parallel-runners"
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.87.1
rev: v1.88.0
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand All @@ -47,6 +47,6 @@ repos:
args:
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 37.198.1
rev: 37.229.5
hooks:
- id: renovate-config-validator
Loading
Loading