Skip to content

Commit

Permalink
Merge pull request #289 from asfadmin/test
Browse files Browse the repository at this point in the history
v1.0.0 Release
  • Loading branch information
asjohnston-asf authored Dec 29, 2023
2 parents a427f99 + 999c1db commit 3c16fc6
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These owners will be requested for review when someone opens a pull request.
* @asfadmin/tools-admin
19 changes: 19 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Changelog updated?

on:
pull_request:
types:
- opened
- labeled
- unlabeled
- synchronize
branches:
- prod
- test

jobs:
call-changelog-check-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/[email protected]
secrets:
USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: aws-actions/configure-aws-credentials@v3
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/labeled-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Is PR labeled?

on:
pull_request:
types:
- opened
- labeled
- unlabeled
- synchronize
branches:
- prod

jobs:
call-labeled-pr-check-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/[email protected]
17 changes: 17 additions & 0 deletions .github/workflows/release-checklist-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Create Release Comment

on:
pull_request:
types:
- opened
branches:
- prod

jobs:
call-release-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/[email protected]
permissions:
pull-requests: write
secrets:
USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Create Release

on:
push:
tags:
- 'v*'

jobs:
call-release-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected]
with:
release_prefix: GRFN Distribution
release_branch: prod
develop_branch: test
secrets:
USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/tag-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Tag New Version

on:
push:
branches:
- prod

jobs:
call-bump-version-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/[email protected]
with:
user: tools-bot
email: [email protected]
secrets:
USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0]
### Added
- Versioned releases are now published to GitHub and changes are tracked in CHANGELOG.md
15 changes: 15 additions & 0 deletions door/src/door/lambda_handler.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import json
import os

import boto3
import serverless_wsgi

from door import app
Expand All @@ -6,5 +10,16 @@
serverless_wsgi.TEXT_MIME_TYPES.append('application/problem+json')


def get_secret(secret_name):
sm = boto3.client('secretsmanager', os.environ['AWS_REGION'])
response = sm.get_secret_value(SecretId=secret_name)
secret = json.loads(response['SecretString'])
return secret


private_key = get_secret(os.environ['PRIVATE_KEY_SECRET_NAME'])['private_key']
os.environ['CLOUDFRONT_PRIVATE_KEY'] = str(private_key)


def handler(event, context):
return serverless_wsgi.handle_request(app, event, context)
14 changes: 0 additions & 14 deletions door/src/door/routes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import os
from datetime import datetime, timedelta, timezone
from urllib.parse import quote_plus
Expand All @@ -25,12 +24,6 @@ def decode_token(token):
return None


@app.before_first_request
def init_app():
private_key = get_secret(os.environ['PRIVATE_KEY_SECRET_NAME'])['private_key']
os.environ['CLOUDFRONT_PRIVATE_KEY'] = str(private_key)


@app.before_request
def authenticate_user():
cookie = request.cookies.get(os.environ['JWT_COOKIE_NAME'])
Expand Down Expand Up @@ -71,10 +64,3 @@ def rsa_signer(message):
cf_signer = CloudFrontSigner(os.environ['CLOUDFRONT_KEY_PAIR_ID'], rsa_signer)
signed_url = cf_signer.generate_presigned_url(base_url, date_less_than=expiration_datetime)
return signed_url


def get_secret(secret_name):
sm = boto3.client('secretsmanager', os.environ['AWS_REGION'])
response = sm.get_secret_value(SecretId=secret_name)
secret = json.loads(response['SecretString'])
return secret
2 changes: 1 addition & 1 deletion requirements-door-binary.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cryptography==41.0.3
cryptography==41.0.7
6 changes: 3 additions & 3 deletions requirements-door.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
boto3==1.28.44
Flask==2.2.5
boto3==1.34.10
Flask==3.0.0
Flask-Cors==4.0.0
rsa==4.9
serverless_wsgi==3.0.2
serverless_wsgi==3.0.3
PyJWT==2.8.0

0 comments on commit 3c16fc6

Please sign in to comment.