Skip to content
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

Refactor the repository layout #378

Merged
merged 90 commits into from
Dec 10, 2024
Merged
Changes from 13 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
33582a1
Add checks for semantic python versions
Feb 14, 2024
9438194
Refactor code for the semantic check
Feb 14, 2024
cea8edc
Add checks for semantic python versions
Feb 14, 2024
d5c7c4a
Refactor code for the semantic check
Feb 14, 2024
f7b9d05
Merge branch 'improvement/correct-semantic-python-version-checks' of …
Mar 18, 2024
327ab73
Remove example of correct semantic version
Mar 18, 2024
4dedf50
Refactor the error message for the user
Mar 20, 2024
e84deea
Improve the semantic error message
Mar 20, 2024
5fdc7be
Fix grammar
michaelsaki Mar 20, 2024
42ef8c2
Refactor regex, add link, and improve comments
Mar 21, 2024
a77e5e1
Update link to use semver.org over regex101.com
Mar 21, 2024
5fe14c7
Remove unnecessary period
michaelsaki Mar 21, 2024
b7896a0
Add a meta hook to the pre-commit configuration
mcdonnnj Apr 20, 2024
260566f
Remove `exclude` directive that does not apply to any files
mcdonnnj Apr 20, 2024
a68994d
Add a lower-bound pin for flake8-docstrings
jsf9k Jul 1, 2024
43b91c7
Use the hashicorp/setup-packer GitHub Action
mcdonnnj Aug 12, 2024
8ada75d
Remove @jasonodoom as a codeowner
jsf9k Aug 23, 2024
2930208
Pin to a specific version
jsf9k Aug 26, 2024
46e0553
Bump actions/cache from 3 to 4
dependabot[bot] Sep 24, 2024
3167421
Bump crazy-max/ghaction-github-status from 3 to 4
dependabot[bot] Sep 24, 2024
6a58c2c
Update pre-commit hook versions
mcdonnnj Aug 12, 2024
553efcb
Manually update the prettier hook
mcdonnnj Aug 12, 2024
184e749
Merge pull request #170 from cisagov/dependabot/github_actions/crazy-…
mcdonnnj Sep 25, 2024
d99c117
Merge pull request #171 from cisagov/dependabot/github_actions/action…
mcdonnnj Sep 25, 2024
2491ca0
Merge pull request #187 from cisagov/improvement/use_setup_packer_action
mcdonnnj Sep 25, 2024
f6c9537
Merge pull request #176 from cisagov/improvement/correct-semantic-pyt…
mcdonnnj Sep 25, 2024
10e5f6f
Merge pull request #188 from cisagov/remove-odoom-as-a-codeowner
mcdonnnj Sep 25, 2024
045a998
Add a pre-commit hook to run pip-audit
mcdonnnj Jan 18, 2024
28dc4ce
Merge pull request #178 from cisagov/improvement/add_pre-commit_meta_…
mcdonnnj Sep 25, 2024
5801cec
Merge pull request #179 from cisagov/improvement/add_pip-audit_pre-co…
mcdonnnj Sep 25, 2024
e61255c
Merge pull request #184 from cisagov/improvement/pin-flake8-docstrings
mcdonnnj Sep 25, 2024
44cd1be
Merge pull request #185 from cisagov/maintenance/update_pre-commit_hooks
mcdonnnj Sep 25, 2024
c502f1a
Use the rbubley/mirrors-prettier hook for prettier
mcdonnnj Aug 12, 2024
f0e55b3
Merge pull request #186 from cisagov/improvement/switch_prettier_hook
mcdonnnj Sep 25, 2024
942c0dc
Add a new trigger for the sync-labels GitHub Actions workflow
mcdonnnj Aug 13, 2024
a267662
Remove unnecessary quotes in the sync-labels workflow
mcdonnnj Aug 13, 2024
dc7f09e
Add four new hooks from pre-commit/pre-commit-hooks
mcdonnnj Sep 14, 2024
343d2cc
Add the GitHubSecurityLab/actions-permissions/monitor Action
mcdonnnj Oct 28, 2024
8a77a8b
Restrict permissions of GITHUB_TOKEN
mcdonnnj Oct 28, 2024
3b1d4ef
Update pre-commit hook versions
mcdonnnj Oct 16, 2024
1d285f2
Sort hook ids in each pre-commit hook entry
mcdonnnj Oct 29, 2024
5da1059
Merge pull request #189 from cisagov/improvement/manually_run_sync-la…
mcdonnnj Oct 30, 2024
ff221ba
Merge pull request #190 from cisagov/improvement/add_actions-permissi…
mcdonnnj Oct 30, 2024
971602a
Merge pull request #191 from cisagov/improvement/github_tokenn_polp
mcdonnnj Oct 30, 2024
bdf8a25
Merge pull request #192 from cisagov/maintenance/update_pre-commit_hooks
mcdonnnj Oct 30, 2024
6959971
Merge pull request #193 from cisagov/improvement/add_more_pre-commit_…
mcdonnnj Oct 30, 2024
f517db7
Merge pull request #194 from cisagov/improvement/ensure_pre-commit_ho…
mcdonnnj Oct 30, 2024
3c8c0ac
Merge remote-tracking branch 'skeleton-generic/develop' into lineage/…
jsf9k Oct 30, 2024
3843f17
Uncomment new Dependabot ignore directive from upstream
jsf9k Oct 30, 2024
8824475
Update the commented out dependabot ignore directives
mcdonnnj Nov 1, 2024
e6afb68
Merge pull request #195 from cisagov/bug/add_missing_dependabot_ignore
mcdonnnj Nov 1, 2024
5a6801b
Install Packer via hashicorp/setup-packer everywhere
jsf9k Oct 30, 2024
7caddb4
Upgrade Bandit to 1.7.10
jsf9k Oct 30, 2024
e0fac13
Add explicit permissions for jobs that lack them
jsf9k Oct 30, 2024
c98703c
Add GitHubSecurityLab/actions-permissions/monitor task to each job th…
jsf9k Oct 30, 2024
469c166
Remove shebang
jsf9k Oct 30, 2024
b752ed8
Add repo read permissions for all jobs that checkout code
jsf9k Oct 31, 2024
36300f3
Remove repeated comment
jsf9k Oct 31, 2024
97a31b9
Update the commented out dependabot ignore directives
jsf9k Nov 7, 2024
52945c2
Resolve conflict from follow-on Lineage update
jsf9k Nov 7, 2024
7748de4
Uncomment new Dependabot directives from upstream
jsf9k Nov 6, 2024
e9db1f5
Upgrade to actions/cache@v4 everywhere
jsf9k Nov 7, 2024
be5bac2
Merge https://github.com/cisagov/skeleton-generic into lineage/skeleton
Nov 7, 2024
1845fd7
Resolve conflict from follow-on Lineage update
jsf9k Nov 7, 2024
26a8baf
Bump up the lower bound on ansible-core
jsf9k Nov 8, 2024
12a91ad
Bump up the lower bound on ansible-core
jsf9k Nov 8, 2024
b9f798d
Update the version of the ansible-lint pre-commit hook
jsf9k Nov 13, 2024
cca133a
Adjust pin for ansible-core
jsf9k Nov 14, 2024
a00c336
Upgrade pin for ansible-core
jsf9k Nov 14, 2024
b2020a8
Ignore a particular ansible-core vulnerability
jsf9k Nov 18, 2024
bd85261
Add comments about looming EOL issues for ansible and ansible-core
jsf9k Nov 20, 2024
d077b67
Add comments about looming EOL issues for ansible and ansible-core
jsf9k Nov 20, 2024
f7ccd9a
Merge pull request #196 from cisagov/improvement/add-a-lower-bound-pi…
jsf9k Nov 20, 2024
a794735
Merge pull request #197 from cisagov/improvement/upgrade-ansible-lint…
jsf9k Nov 20, 2024
9978de5
Merge https://github.com/cisagov/skeleton-generic into lineage/skeleton
Nov 20, 2024
c8ca96b
Move the Packer template to the root of the repository
mcdonnnj Oct 4, 2024
6c478f0
Move the version file to the root of the repository
mcdonnnj Oct 4, 2024
ad2b768
Rename src/ to ansible/
mcdonnnj Oct 4, 2024
354a1b0
Move the Packer template variables to their own file
mcdonnnj Oct 4, 2024
4ac76ee
Move the Packer template locals to their own file
mcdonnnj Oct 4, 2024
48934ca
Move the Packer template's build block to its own file
mcdonnnj Oct 4, 2024
566245a
Move the Packer template's AMI sources to their own files
mcdonnnj Oct 4, 2024
4b59dc7
Move the Packer template's AMI data blocks to their own file
mcdonnnj Oct 4, 2024
8b7217e
Update the README
mcdonnnj Oct 4, 2024
4d45cfc
Add a `terraform-docs` configuration
mcdonnnj Oct 4, 2024
868b3d6
Run `terraform-docs` to populate the README
mcdonnnj Oct 4, 2024
f069241
Update the README
mcdonnnj Oct 4, 2024
d733578
Rename the `packer.pkr.hcl` file
mcdonnnj Oct 10, 2024
ee0ffe8
Simply the CODEOWNERS configuration for the Packer template
mcdonnnj Oct 15, 2024
d862b89
Add a missed space in the README
mcdonnnj Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 50 additions & 20 deletions setup-env
Original file line number Diff line number Diff line change
@@ -39,6 +39,52 @@ python_versions() {
pyenv versions --bare --skip-aliases --skip-envs
}

check_python_version() {
local version=$1

# This is a valid regex for semantically correct Python version strings.
# For more information see here:
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# Break down the regex into readable parts major.minor.patch
local major="0|[1-9]\d*"
local minor="0|[1-9]\d*"
local patch="0|[1-9]\d*"

# Splitting the prerelease part for readability
# Start of the prerelease
local prerelease="(?:-"
# Numeric or alphanumeric identifiers
local prerelease+="(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)"
# Additional dot-separated identifiers
local prerelease+="(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*"
# End of the prerelease, making it optional
local prerelease+=")?"
# Optional build metadata
local build="(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?"

# Final regex composed of parts
local regex="^($major)\.($minor)\.($patch)$prerelease$build$"

# This checks if the Python version does not match the regex pattern specified in $regex,
# using Perl for regex matching. If the pattern is not found, then prompt the user with
# the invalid version message.
if ! echo "$version" | perl -ne "exit(!/$regex/)"; then
echo "Invalid version of Python: Python follows semantic versioning," \
"so any version string that is not a valid semantic version is an" \
"invalid version of Python."
exit 1
# Else if the Python version isn't installed then notify the user.
# grep -E is used for searching through text lines that match the specific verison.
elif ! python_versions | grep -E "^${version}$" > /dev/null; then
echo "Error: Python version $version is not installed."
echo "Installed Python versions are:"
python_versions
exit 1
else
echo "Using Python version $version"
fi
}

# Flag to force deletion and creation of virtual environment
FORCE=0

@@ -144,17 +190,8 @@ while true; do
-p | --python-version)
PYTHON_VERSION="$2"
shift 2
# Check the Python versions being passed in.
if [ -n "${PYTHON_VERSION+x}" ]; then
if python_versions | grep -E "^${PYTHON_VERSION}$" > /dev/null; then
echo Using Python version "$PYTHON_VERSION"
else
echo Error: Python version "$PYTHON_VERSION" is not installed.
echo Installed Python versions are:
python_versions
exit 1
fi
fi
# Check the Python version being passed in.
check_python_version "$PYTHON_VERSION"
;;
-v | --venv-name)
VENV_NAME="$2"
@@ -188,15 +225,8 @@ if [ $LIST_VERSIONS -ne 0 ]; then
# Read the user's desired Python version.
# -r: treat backslashes as literal, -p: display prompt before input.
read -r -p "Enter the desired Python version: " PYTHON_VERSION
# Check the Python versions being passed in.
if [ -n "${PYTHON_VERSION+x}" ]; then
if python_versions | grep -E "^${PYTHON_VERSION}$" > /dev/null; then
echo Using Python version "$PYTHON_VERSION"
else
echo Error: Python version "$PYTHON_VERSION" is not installed.
exit 1
fi
fi
# Check the Python version being passed in.
check_python_version "$PYTHON_VERSION"
fi

# Remove any lingering local configuration.