Skip to content

Commit

Permalink
Migrate workflows (#80)
Browse files Browse the repository at this point in the history
* install workflows

* Upstream migration
  • Loading branch information
osterman authored May 1, 2024
1 parent 3089def commit c1398e6
Show file tree
Hide file tree
Showing 22 changed files with 427 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[*]
insert_final_newline = true

# Override for Makefile
[{Makefile,makefile,GNUmakefile}]
indent_style = tab
indent_size = 4

[Makefile.*]
indent_style = tab
indent_size = 4

[*.md]
indent_style = space
indent_size = 2

[{*.yaml,*.yml}]
indent_style = space
indent_size = 2

[*.sh]
indent_style = tab
indent_size = 2
5 changes: 3 additions & 2 deletions migrate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Create a migration script in [`migrations/<date>/script.sh`](migrations/) and us

```shell
# Export this environment variable to actually create and merge PRs
XARGS_DRY_RUN=false
export XARGS_DRY_RUN=false

# Pass the migration and the list of repos in the migration to process.
./git-xargs.sh 20240304 repos.txt
Expand Down Expand Up @@ -37,6 +37,7 @@ Including a `default` folder, which is used when no files are found for a given

1. Use `yq` for manipulating YAML. It will preserve comments but not whitespace. It will also replace Unicode characters with their escape sequence. Use `yamlfix` to restore the Unicode character.
2. Use `yamlfix` to format YAML and normalize whitespace.
3. Create a list of repos using the `gh repo list` command

<details><summary>Past Limitations Using `git-xargs` CLI</summary>

Expand All @@ -49,4 +50,4 @@ We encountered significant obstacles using `git-xargs`. Here they are for poster
- `git-xargs` will not update PR title/description, so it's advisable to just use `gh` CLI instead
- `git-xargs` cannot auto-merge, so use `gh-cli` in script to commit, push, open PR, then merge
- Using `gh-cli` to bypass the `git-xargs` deficiencies, means rate limiting isn't respected by `git-xargs`
</details>
</details>
11 changes: 10 additions & 1 deletion migrate/lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ function install() {
local destination=${2:-$source}
local source_file=$(template_file $source)
if [ -f "${source_file}" ]; then
info "Installing $destination from $source_file"
info "Installing file $destination from $source_file"
cp -a $source_file $destination
git add $destination
elif [ -d "${source_file}" ]; then
info "Installing directory $destination from $source_file"
mkdir -p $destination
cp -a $source_file/ $destination/
git add $destination
else
error "Template not found: $source"
Expand All @@ -66,6 +71,10 @@ function template_file() {
echo ${MIGRATE_PATH}/templates/${REPO_TYPE}/$1
elif [ -f ${MIGRATE_PATH}/templates/default/$1 ]; then
echo ${MIGRATE_PATH}/templates/default/$1
elif [ -d ${MIGRATE_PATH}/templates/${REPO_TYPE}/$1 ]; then
echo ${MIGRATE_PATH}/templates/${REPO_TYPE}/$1
elif [ -d ${MIGRATE_PATH}/templates/default/$1 ]; then
echo ${MIGRATE_PATH}/templates/default/$1
else
error "Template not found: $1"
fi
Expand Down
8 changes: 8 additions & 0 deletions migrate/migrations/20240410/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## what

- Install latest GitHub Action Workflows

## why

- Use shared workflows from `cldouposse/.github` repository
- Simplify management of workflows from centralized hub of configuration
16 changes: 16 additions & 0 deletions migrate/migrations/20240410/repos-00
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cloudposse/terraform-aws-iam-user
cloudposse/terraform-example-module
cloudposse/terraform-aws-ssm-tls-ssh-key-pair
cloudposse/terraform-aws-eks-cluster
cloudposse/terraform-aws-mq-broker
cloudposse/terraform-aws-ecs-web-app
cloudposse/terraform-aws-eks-iam-role
cloudposse/terraform-aws-iam-role
cloudposse/terraform-aws-sns-topic
cloudposse/terraform-aws-datadog-lambda-forwarder
cloudposse/terraform-aws-ecs-codepipeline
cloudposse/terraform-aws-ssm-patch-manager
cloudposse/terraform-aws-components
cloudposse/terraform-aws-eks-fargate-profile
cloudposse/terraform-aws-eks-node-group
cloudposse/terraform-aws-dms
16 changes: 16 additions & 0 deletions migrate/migrations/20240410/repos-01
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cloudposse/terraform-aws-mwaa
cloudposse/terraform-aws-waf
cloudposse/terraform-aws-redshift-cluster
cloudposse/terraform-aws-vpc-peering-multi-account
cloudposse/terraform-aws-ecs-alb-service-task
cloudposse/terraform-aws-tfstate-backend
cloudposse/terraform-aws-iam-system-user
cloudposse/terraform-aws-budgets
cloudposse/terraform-aws-lakeformation
cloudposse/terraform-aws-kinesis-stream
cloudposse/terraform-aws-ecs-cluster
cloudposse/terraform-aws-kv-store
cloudposse/terraform-artifactory-kv-store
cloudposse/terraform-aws-refarch-utils
cloudposse/terraform-aws-network-firewall
cloudposse/terraform-aws-firewall-manager
16 changes: 16 additions & 0 deletions migrate/migrations/20240410/repos-02
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cloudposse/terraform-yaml-stack-config
cloudposse/terraform-aws-security-group
cloudposse/terraform-aws-amplify-app
cloudposse/terraform-module-test
cloudposse/terraform-aws-route53-resolver-dns-firewall
cloudposse/terraform-aws-step-functions
cloudposse/terraform-aws-github-action-token-rotator
cloudposse/terraform-aws-glue
cloudposse/terraform-aws-athena
cloudposse/terraform-aws-lambda-function
cloudposse/terraform-aws-ecr-public
cloudposse/terraform-aws-ec2-client-vpn
cloudposse/terraform-aws-ssm-tls-self-signed-cert
cloudposse/terraform-aws-service-quotas
cloudposse/terraform-aws-rds-db-proxy
cloudposse/terraform-aws-api-gateway
16 changes: 16 additions & 0 deletions migrate/migrations/20240410/repos-03
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cloudposse/terraform-cloudflare-waf-rulesets
cloudposse/terraform-aws-code-deploy
cloudposse/terraform-aws-transfer-sftp
cloudposse/terraform-aws-iam-policy
cloudposse/terraform-aws-helm-release
cloudposse/terraform-aws-health-events
cloudposse/terraform-aws-global-accelerator
cloudposse/terraform-aws-macie
cloudposse/terraform-cloudflare-zone
cloudposse/terraform-aws-config-storage
cloudposse/terraform-aws-sso
cloudposse/terraform-aws-rds-replica
cloudposse/terraform-aws-emr-cluster
cloudposse/terraform-spacelift-cloud-infrastructure-automation
cloudposse/terraform-aws-security-hub
cloudposse/terraform-aws-config
16 changes: 16 additions & 0 deletions migrate/migrations/20240410/repos-04
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cloudposse/terraform-aws-utils
cloudposse/terraform-aws-eks-spotinst-ocean-nodepool
cloudposse/terraform-aws-service-control-policies
cloudposse/terraform-kubernetes-tfc-cloud-agent
cloudposse/terraform-aws-guardduty
cloudposse/terraform-aws-inspector
cloudposse/terraform-aws-msk-apache-kafka-cluster
cloudposse/terraform-yaml-config
cloudposse/terraform-opsgenie-incident-management
cloudposse/terraform-aws-cloudwatch-events
cloudposse/terraform-aws-nlb
cloudposse/terraform-aws-transit-gateway
cloudposse/terraform-aws-sns-cloudwatch-sns-alarms
cloudposse/terraform-aws-vpc-flow-logs-s3-bucket
cloudposse/terraform-aws-ses
cloudposse/terraform-aws-backup
16 changes: 16 additions & 0 deletions migrate/migrations/20240410/repos-05
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cloudposse/terraform-aws-spotinst-mrscaler
cloudposse/terraform-aws-ssm-parameter-chamber-reader
cloudposse/terraform-aws-cloudformation-stack
cloudposse/terraform-aws-cloudformation-stack-set
cloudposse/terraform-aws-s3-bucket
cloudposse/terraform-aws-iam-chamber-s3-role
cloudposse/terraform-aws-documentdb-cluster
cloudposse/terraform-aws-vpn-connection
cloudposse/terraform-external-module-artifact
cloudposse/terraform-aws-lambda-elasticsearch-cleanup
cloudposse/terraform-aws-rds-cluster-instance-group
cloudposse/terraform-github-repository-webhooks
cloudposse/terraform-aws-iam-account-settings
cloudposse/terraform-null-smtp-mail
cloudposse/terraform-aws-eks-workers
cloudposse/terraform-aws-elasticsearch
16 changes: 16 additions & 0 deletions migrate/migrations/20240410/repos-06
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cloudposse/terraform-aws-ecs-launch-template
cloudposse/terraform-aws-ec2-autoscale-group
cloudposse/terraform-aws-ses-lambda-forwarder
cloudposse/terraform-aws-sns-lambda-notify-slack
cloudposse/terraform-aws-ecs-cloudwatch-autoscaling
cloudposse/terraform-aws-alb-target-group-cloudwatch-sns-alarms
cloudposse/terraform-aws-ecs-cloudwatch-sns-alarms
cloudposse/terraform-aws-cloudtrail-cloudwatch-alarms
cloudposse/terraform-aws-ssm-parameter-store-policy-documents
cloudposse/terraform-aws-ecs-spot-fleet
cloudposse/terraform-aws-ssm-iam-role
cloudposse/terraform-aws-lambda-cloudwatch-sns-alarms
cloudposse/terraform-aws-sqs-cloudwatch-sns-alarms
cloudposse/terraform-aws-elasticache-cloudwatch-sns-alarms
cloudposse/terraform-aws-ecs-events
cloudposse/terraform-aws-alb-ingress
16 changes: 16 additions & 0 deletions migrate/migrations/20240410/repos-07
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cloudposse/terraform-aws-lb-s3-bucket
cloudposse/terraform-aws-alb
cloudposse/terraform-aws-iam-s3-user
cloudposse/terraform-aws-ecs-container-definition
cloudposse/terraform-aws-efs-cloudwatch-sns-alarms
cloudposse/terraform-aws-ec2-instance-group
cloudposse/terraform-aws-rds-cloudwatch-sns-alarms
cloudposse/terraform-aws-ssm-parameter-store
cloudposse/terraform-terraform-label
cloudposse/terraform-aws-cloudtrail-s3-bucket
cloudposse/terraform-tls-ssh-key-pair
cloudposse/terraform-aws-kms-key
cloudposse/terraform-aws-dynamodb-autoscaler
cloudposse/terraform-aws-organization-access-group
cloudposse/terraform-aws-organization-access-role
cloudposse/terraform-aws-cloudwatch-flow-logs
16 changes: 16 additions & 0 deletions migrate/migrations/20240410/repos-08
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cloudposse/terraform-aws-named-subnets
cloudposse/terraform-aws-dynamodb
cloudposse/terraform-aws-cloudwatch-logs
cloudposse/terraform-aws-multi-az-subnets
cloudposse/terraform-aws-vpc-peering
cloudposse/terraform-aws-datadog-integration
cloudposse/terraform-null-label
cloudposse/terraform-aws-efs
cloudposse/terraform-aws-iam-assumed-roles
cloudposse/terraform-aws-elasticache-redis
cloudposse/terraform-aws-elasticache-memcached
cloudposse/terraform-aws-elastic-beanstalk-environment
cloudposse/terraform-aws-elastic-beanstalk-application
cloudposse/terraform-aws-ec2-instance
cloudposse/terraform-aws-ec2-bastion-server
cloudposse/terraform-aws-ec2-ami-snapshot
16 changes: 16 additions & 0 deletions migrate/migrations/20240410/repos-09
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cloudposse/terraform-aws-ec2-admin-server
cloudposse/terraform-aws-dynamic-subnets
cloudposse/terraform-aws-codebuild
cloudposse/terraform-null-ansible
cloudposse/terraform-aws-vpc
cloudposse/terraform-aws-s3-website
cloudposse/terraform-aws-s3-log-storage
cloudposse/terraform-aws-route53-cluster-zone
cloudposse/terraform-aws-route53-cluster-hostname
cloudposse/terraform-aws-route53-alias
cloudposse/terraform-aws-rds-cluster
cloudposse/terraform-aws-rds
cloudposse/terraform-aws-key-pair
cloudposse/terraform-aws-efs-backup
cloudposse/terraform-aws-ecr
cloudposse/terraform-aws-cloudtrail
7 changes: 7 additions & 0 deletions migrate/migrations/20240410/repos-10
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cloudposse/terraform-aws-cloudfront-s3-cdn
cloudposse/terraform-aws-cloudfront-cdn
cloudposse/terraform-aws-cicd
cloudposse/terraform-aws-acm-request-certificate
cloudposse/terraform-aws-ec2-ami-backup
cloudposse/terraform-datadog-platform
cloudposse/terraform-aws-batch
1 change: 1 addition & 0 deletions migrate/migrations/20240410/repos-11
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cloudposse/tap-terraform-registry
5 changes: 5 additions & 0 deletions migrate/migrations/20240410/repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
gh repo list cloudposse --limit 500 --json name,owner \
--jq '.[] | select(.name | test("^terraform")) | select(.name | test("^terraform-provider") | not) | .owner.login + "/" + .name' > repos.txt

split -d -l 16 repos.txt repos-
Loading

0 comments on commit c1398e6

Please sign in to comment.