Skip to content

Commit

Permalink
inital commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tmclaugh committed Oct 13, 2024
0 parents commit 9a8b5c7
Show file tree
Hide file tree
Showing 8 changed files with 393 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Main

on:
workflow_dispatch:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

steps:
- name: Setup job workspace
uses: ServerlessOpsIO/gha-setup-workspace@v1

- name: Assume AWS Credentials
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
with:
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}

- name: Install AWS SAM
uses: aws-actions/setup-sam@v2


- name: Validate template
run: sam validate --lint

- name: Build artifact
run: sam build --parallel --template template.yaml

- name: Store Artifacts
uses: ServerlessOpsIO/gha-store-artifacts@v1
with:
use_aws_sam: true

deploy_sandbox:
needs:
- build

environment: sandbox
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

steps:
- name: Setup job workspace
uses: ServerlessOpsIO/gha-setup-workspace@v1
with:
checkout_artifact: true

- name: Assume AWS Credentials
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
with:
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
deploy_aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }}

- name: Deploy via AWS SAM
uses: ServerlessOpsIO/gha-deploy-aws-sam@v1
with:
aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }}
env_json: ${{ toJson(env) }}
secrets_json: ${{ toJson(secrets) }}
78 changes: 78 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Dev
.mypy_cache/

# pyenv / environments
.python-version
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# IDE
.settings/
.project
.pydevproject
.vscode/
*.code-workspace

# Mac Cruft
.DS_Store

# Deploy
codepipeline-config-*.yaml


# AWS SAM
.aws-sam/
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Backstage Cluster

ECS Cluster for Backstage
16 changes: 16 additions & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: ${{ values.component_name }}
description: ${{ values.component_description }}
namespace: ${{ values.component_namespace }}
annotations:
github.com/project-slug: NBCUniversal/${{ values.component_name }}
backstage.io/techdocs-ref: dir:.
spec:
type: aws_ecs_cluster
lifecycle: production
owner: ${{ values.owner }}
system: ${{ values.system_entity }}
domain: ${{ values.domain_entity }}
10 changes: 10 additions & 0 deletions cfn-parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Domain": "Infrastructure",
"System": "Backstage",
"Component": $env.GITHUB_REPOSITORY_NAME_PART_SLUG_CS,
"CodeBranch": $env.GITHUB_REF_SLUG_CS,
"VpcId": "/org/networking/VpcId",
"VpcSubnets": "/org/networking/VpcPublicSubnets",
"Hostname": "backstage.serverlessops.io",
"DnsZoneId": "/org/dns/ZoneId"
}
6 changes: 6 additions & 0 deletions cfn-tags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"org:domain": "Infrastructure",
"org:system": "Backstage",
"org:component": $env.GITHUB_REPOSITORY_NAME_PART_SLUG_CS,
"org:code-branch": $env.GITHUB_REF_SLUG_CS,
}
31 changes: 31 additions & 0 deletions samconfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# More information about the configuration file can be found here:
# https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html
version = 0.1

[default]
[default.global.parameters]
stack_name = "backstage-cluster"

[default.build.parameters]
cached = true
parallel = true

[default.validate.parameters]
lint = true

[default.deploy.parameters]
capabilities = "CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND"
confirm_changeset = false
#resolve_s3 = true

[default.package.parameters]
#resolve_s3 = true

[default.sync.parameters]
watch = true

[default.local_start_api.parameters]
warm_containers = "EAGER"

[default.local_start_lambda.parameters]
warm_containers = "EAGER"
Loading

0 comments on commit 9a8b5c7

Please sign in to comment.