Skip to content

Commit eae9a07

Browse files
committed
Initial commit
0 parents  commit eae9a07

File tree

13 files changed

+337
-0
lines changed

13 files changed

+337
-0
lines changed

.cfnlintrc

Whitespace-only changes.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Feature Branch
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- feature/*
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
steps:
17+
- name: Setup job workspace
18+
uses: ServerlessOpsIO/gha-setup-workspace@v1
19+
20+
- name: Assume AWS Credentials
21+
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
22+
with:
23+
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
24+
25+
- name: Install AWS SAM
26+
uses: aws-actions/setup-sam@v2
27+
28+
29+
- name: Validate template
30+
run: sam validate --lint
31+
32+
- name: Build artifact
33+
run: sam build --parallel --template template.yaml
34+
35+
# Disableing until a full workflow for feature branches is figured out.
36+
- name: Store Artifacts
37+
if: false
38+
uses: ServerlessOpsIO/gha-store-artifacts@v1
39+
with:
40+
use_aws_sam: true
41+
42+
deploy:
43+
# Disableing until a full workflow for feature branches is figured out.
44+
if: false
45+
needs:
46+
- build
47+
48+
environment: feature
49+
runs-on: ubuntu-latest
50+
permissions:
51+
id-token: write
52+
contents: read
53+
54+
steps:
55+
- name: Setup job workspace
56+
uses: ServerlessOpsIO/gha-setup-workspace@v1
57+
with:
58+
checkout_artifact: true
59+
60+
- name: Assume AWS Credentials
61+
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
62+
with:
63+
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
64+
deploy_aws_account_id: ${{ secrets.AWS_MANAGEMENT_ACCOUNT_ID }}
65+
66+
- name: Deploy via AWS SAM
67+
uses: ServerlessOpsIO/gha-deploy-aws-sam@v1
68+
with:
69+
aws_account_id: ${{ secrets.AWS_MANAGEMENT_ACCOUNT_ID }}
70+
env_json: ${{ toJson(env) }}
71+
secrets_json: ${{ toJson(secrets) }}

.github/workflows/main.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Main
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
steps:
17+
- name: Setup job workspace
18+
uses: ServerlessOpsIO/gha-setup-workspace@v1
19+
20+
- name: Assume AWS Credentials
21+
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
22+
with:
23+
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
24+
25+
- name: Install AWS SAM
26+
uses: aws-actions/setup-sam@v2
27+
28+
29+
- name: Validate template
30+
run: sam validate --lint
31+
32+
- name: Validate template
33+
run: sam validate --lint --template ./stacksets/userpool/stackset.yaml
34+
35+
- name: Synethsize StackSet templates
36+
run: |
37+
for _f in $(find . -type f -name 'template.yaml'); do
38+
_dir="$(dirname $_f)/" \
39+
yq \
40+
-i \
41+
'(.. | select(has("localTemplateFile")) | .localTemplateFile) |= load_str(strenv(_dir) + .)' \
42+
$_f;
43+
done
44+
45+
- name: Store Artifacts
46+
uses: ServerlessOpsIO/gha-store-artifacts@v1
47+
with:
48+
use_aws_sam: true
49+
50+
deploy:
51+
needs:
52+
- build
53+
environment: production
54+
runs-on: ubuntu-latest
55+
permissions:
56+
id-token: write
57+
contents: read
58+
59+
steps:
60+
- name: Setup job workspace
61+
uses: ServerlessOpsIO/gha-setup-workspace@v1
62+
with:
63+
checkout_artifact: true
64+
65+
- name: Assume AWS Credentials
66+
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
67+
with:
68+
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
69+
deploy_aws_account_id: ${{ secrets.AWS_MANAGEMENT_ACCOUNT_ID }}
70+
71+
- name: Deploy via AWS SAM
72+
uses: ServerlessOpsIO/gha-deploy-aws-sam@v1
73+
with:
74+
aws_account_id: ${{ secrets.AWS_MANAGEMENT_ACCOUNT_ID }}
75+
env_json: ${{ toJson(env) }}
76+
secrets_json: ${{ toJson(secrets) }}

.gitignore

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Dev
51+
.mypy_cache/
52+
53+
# pyenv / environments
54+
.python-version
55+
.env
56+
.venv
57+
env/
58+
venv/
59+
ENV/
60+
env.bak/
61+
venv.bak/
62+
63+
# IDE
64+
.settings/
65+
.project
66+
.pydevproject
67+
.vscode/
68+
*.code-workspace
69+
.idea/
70+
71+
# Mac Cruft
72+
.DS_Store
73+
74+
# Deploy
75+
codepipeline-config-*.yaml
76+
77+
78+
# AWS SAM
79+
.aws-sam/

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ServerlesOps Catalog API
2+
3+
The home for everything with no better place to go.
4+
5+
This provides a source of truth to be consumed by Backstage for entities that lack their own programatic source. While most entities can have a programatic source of truth, some abstract entities such as Domains and Services do not. Also, some entities may have a programatic source of truth but we don't want to allow Backstage direct access to it. Eg. AWS organization and account info. This API provides us a place to store that information.

catalog-info.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
apiVersion: backstage.io/v1alpha1
3+
kind: Component
4+
metadata:
5+
name: serverlessops-api-authnz
6+
description: ServerlessOps API Authnz Service
7+
annotations:
8+
github.com/project-slug: ServerlessOpsIO/serverlessops-api-authnz/=
9+
spec:
10+
type: api
11+
lifecycle: production
12+
owner: group:admins
13+
system: ServerlessOps API Authnz

cfn-parameters.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"Domain": "infra",
3+
"System": "ApiAuthnz",
4+
"Component": $env.GITHUB_REPOSITORY_NAME_PART_SLUG_CS,
5+
"CodeBranch": $env.GITHUB_REF_SLUG_CS,
6+
"UserPoolName": $secrets.USER_POOL_NAME,
7+
"UserPoolDomainName": $secrets.USER_POOL_DOMAIN_NAME,
8+
"DnsZoneId": "/org/dns/ZoneId",
9+
"TargetOuIds": $secrets.DEPLOYMENT_TARGET_OU,
10+
"TargetRegions": "us-east-1",
11+
"TargetAccountIds": $secrets.DEPLOYMENT_TARGET_ACCOUNT_ID,
12+
}

cfn-tags.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"org:domain": "infra",
3+
"org:system": "serverlessops-api-authnz",
4+
"org:component": $env.GITHUB_REPOSITORY_NAME_PART_SLUG_CS
5+
}

samconfig.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version = 0.1
2+
[default]
3+
4+
[default.deploy]
5+
6+
[default.deploy.parameters]
7+
stack_name = "serverlessops-api-authnz"
8+
confirm_changeset = false
9+
capabilities = "CAPABILITY_NAMED_IAM"

stacksets/client/stackset.yaml

Whitespace-only changes.

0 commit comments

Comments
 (0)