-
Notifications
You must be signed in to change notification settings - Fork 2
Initial implementation #3
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
836bfae
Add Docker scaffolding
mcdonnnj 75e637e
Add the script to build a deployment package artifact
mcdonnnj d824f15
Add Pipfiles for each supported Python version
mcdonnnj 109d223
Add Lambda handler
mcdonnnj 7c5ea91
Update the Lambda build process
mcdonnnj 87eae5e
Add a `build` job to the GitHub Actions workflow
mcdonnnj 0b8c693
Update project README
mcdonnnj 02afeb5
Add version management
mcdonnnj 7f3aa84
Add a barebones testing harness
mcdonnnj 9c50c1f
Add a CodeQL workflow
mcdonnnj a2a4383
Add a release workflow
mcdonnnj 80f0872
Fix vendor label in Dockerfile
mcdonnnj a4a5cde
Update to use long flag names
mcdonnnj b2014b6
Improve error messages for the `divide` task
mcdonnnj 56b9ac9
Fix language in `lambda_handler.py`
mcdonnnj 3d9c3dd
Update the bandit pre-commit hook entries
mcdonnnj 9014297
Update `pytest.ini` to use long flag names
mcdonnnj 6cb7864
Update Dockerfile label information
mcdonnnj 1468097
Update the artifact production process
mcdonnnj 95d619a
Update dependency installation
mcdonnnj 7d5c25e
Add Python dependency maintenance instructions
mcdonnnj 2b5f9d7
Update Python dependencies
mcdonnnj 915eb71
Update missed GitHub Action versions
mcdonnnj 6f98ec5
Add commented out dependabot ignore information
mcdonnnj 78b1cd2
Remove the release.yml workflow
mcdonnnj bde97e0
Pull in updates to the bump_version.sh script
mcdonnnj 2a44cdc
Use a multi-stage build for the Lambda image
mcdonnnj a62a300
Ensure pipenv uses the system Python instead of a venv
mcdonnnj a0036c7
Enable changing the image tag used with Docker Compose
mcdonnnj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
# Dependabot triggered push events have read-only access, but uploading code | ||
# scanning requires write access. | ||
branches-ignore: | ||
- dependabot/** | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: | ||
- develop | ||
schedule: | ||
- cron: '0 14 * * 6' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# required for all workflows | ||
security-events: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Override automatic language detection by changing the below list | ||
# Supported options are go, javascript, csharp, python, cpp, and java | ||
language: | ||
- python | ||
# Learn more... | ||
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or | ||
# Java). If this step fails, then you should remove it and run the build | ||
# manually (see below). | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following | ||
# three lines and modify them (or add more) to build your code if your | ||
# project uses a compiled language | ||
|
||
# - run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
ARG PY_VERSION=3.9 | ||
|
||
FROM amazon/aws-lambda-python:$PY_VERSION as install-stage | ||
|
||
# Declare it a second time so it's brought into this scope. | ||
ARG PY_VERSION=3.9 | ||
|
||
# Install the Python packages necessary to install the Lambda dependencies. | ||
RUN python3 -m pip install --no-cache-dir \ | ||
pip \ | ||
setuptools \ | ||
wheel \ | ||
# This version of pipenv is the minimum version to allow passing arguments | ||
# to pip with the --extra-pip-args option. | ||
&& python3 -m pip install --no-cache-dir "pipenv>=2022.9.8" | ||
|
||
WORKDIR /tmp | ||
|
||
# Copy in the dependency files. | ||
COPY src/py$PY_VERSION/ . | ||
|
||
# Install the Lambda dependencies. | ||
# | ||
# The --extra-pip-args option is used to pass necessary arguments to the | ||
# underlying pip calls. | ||
RUN pipenv sync --system --extra-pip-args="--no-cache-dir --target ${LAMBDA_TASK_ROOT}" | ||
jsf9k marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
FROM amazon/aws-lambda-python:$PY_VERSION as build-stage | ||
|
||
### | ||
# For a list of pre-defined annotation keys and value types see: | ||
# https://github.com/opencontainers/image-spec/blob/master/annotations.md | ||
### | ||
# github@cisa.dhs.gov is a very generic email distribution, and it is | ||
# unlikely that anyone on that distribution is familiar with the | ||
# particulars of your repository. It is therefore *strongly* | ||
# suggested that you use an email address here that is specific to the | ||
# person or group that maintains this repository; for example: | ||
# LABEL org.opencontainers.image.authors="vm-fusion-dev-group@trio.dhs.gov" | ||
LABEL org.opencontainers.image.authors="github@cisa.dhs.gov" | ||
LABEL org.opencontainers.image.vendor="Cybersecurity and Infrastructure Security Agency" | ||
|
||
# Declare it a third time so it's brought into this scope. | ||
ARG PY_VERSION=3.9 | ||
|
||
# This must be present in the image to generate a deployment artifact. | ||
ENV BUILD_PY_VERSION=$PY_VERSION | ||
|
||
COPY --from=install-stage ${LAMBDA_TASK_ROOT} ${LAMBDA_TASK_ROOT} | ||
|
||
WORKDIR ${LAMBDA_TASK_ROOT} | ||
|
||
# Copy in the handler. | ||
COPY src/lambda_handler.py . | ||
|
||
# Ensure our handler is invoked when the image is used. | ||
CMD ["lambda_handler.handler"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
# bump_version.sh (show|major|minor|patch|prerelease|build) | ||
|
||
set -o nounset | ||
set -o errexit | ||
set -o pipefail | ||
|
||
VERSION_FILE=src/version.txt | ||
|
||
HELP_INFORMATION="bump_version.sh (show|major|minor|patch|prerelease|build|finalize)" | ||
|
||
old_version=$(sed -n "s/^__version__ = \"\(.*\)\"$/\1/p" $VERSION_FILE) | ||
# Comment out periods so they are interpreted as periods and don't | ||
# just match any character | ||
old_version_regex=${old_version//\./\\\.} | ||
|
||
if [ $# -ne 1 ]; then | ||
echo "$HELP_INFORMATION" | ||
else | ||
case $1 in | ||
major | minor | patch | prerelease | build) | ||
new_version=$(python -c "import semver; print(semver.bump_$1('$old_version'))") | ||
echo Changing version from "$old_version" to "$new_version" | ||
# A temp file is used to provide compatability with macOS development | ||
# as a result of macOS using the BSD version of sed | ||
tmp_file=/tmp/version.$$ | ||
sed "s/$old_version_regex/$new_version/" $VERSION_FILE > $tmp_file | ||
mv $tmp_file $VERSION_FILE | ||
git add $VERSION_FILE | ||
git commit -m"Bump version from $old_version to $new_version" | ||
git push | ||
;; | ||
finalize) | ||
new_version=$(python -c "import semver; print(semver.finalize_version('$old_version'))") | ||
echo Changing version from "$old_version" to "$new_version" | ||
# A temp file is used to provide compatability with macOS development | ||
# as a result of macOS using the BSD version of sed | ||
tmp_file=/tmp/version.$$ | ||
sed "s/$old_version_regex/$new_version/" $VERSION_FILE > $tmp_file | ||
mv $tmp_file $VERSION_FILE | ||
git add $VERSION_FILE | ||
git commit -m"Finalize version from $old_version to $new_version" | ||
git push | ||
;; | ||
show) | ||
echo "$old_version" | ||
;; | ||
*) | ||
echo "$HELP_INFORMATION" | ||
;; | ||
esac | ||
fi |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.