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

Use nitor-vault 2.2+ version #172

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on:
branches:
- master
paths:
- ".github/workflows/pytest.yml"
- "**.py"
- ".github/workflows/pytest.yml"
- "dev-requirements.txt"
- "pyproject.toml"
- "requirements.txt"
pull_request:
paths:
- ".github/workflows/pytest.yml"
- "**.py"
- ".github/workflows/pytest.yml"
- "dev-requirements.txt"
- "pyproject.toml"
- "requirements.txt"
Expand Down Expand Up @@ -43,14 +43,14 @@ jobs:
- name: Install dependencies
run: |
if [ ! -d ".venv" ]; then
python -m venv .venv
python3 -m venv .venv
fi
source .venv/bin/activate
pip install -U pip setuptools wheel
pip install -r requirements.txt
pip install -r dev-requirements.txt
python3 -m pip install -U pip setuptools wheel
python3 -m pip install -r requirements.txt
python3 -m pip install -r dev-requirements.txt

- name: Run tests
run: |
source .venv/bin/activate
python -m pytest --verbose --color=yes .
python3 -m pytest --verbose --color=yes .
14 changes: 8 additions & 6 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ on:
branches:
- master
paths:
- ".github/workflows/ruff.yml"
- "**.py"
- ".github/workflows/ruff.yml"
- "pyproject.toml"
- "requirements.txt"
- "dev-requirements.txt"
pull_request:
paths:
- ".github/workflows/ruff.yml"
- "**.py"
- ".github/workflows/ruff.yml"
- "pyproject.toml"
- "requirements.txt"
- "dev-requirements.txt"

# https://github.com/chartboost/ruff-action
# https://github.com/astral-sh/ruff-action
jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -27,14 +29,14 @@ jobs:
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: 3.x

- name: Ruff lint
uses: chartboost/ruff-action@v1
uses: astral-sh/ruff-action@v1
with:
args: check --verbose

- name: Ruff format
uses: chartboost/ruff-action@v1
uses: astral-sh/ruff-action@v1
with:
args: format --check --verbose
16 changes: 5 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,20 @@ repos:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
args: [--unsafe]
args: [ --unsafe ]
- id: debug-statements
- id: end-of-file-fixer
exclude: ^docs/commands\.md$
- id: mixed-line-ending
- id: trailing-whitespace
exclude: ^docs/commands\.md$

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.7.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
hooks:
- id: ruff
name: python ruff lint
args: [--fix, --exit-non-zero-on-fix]
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format
name: python ruff format
args: [--check]

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: python isort
args: [ --check ]
22 changes: 7 additions & 15 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ argcomplete==3.5.1
# via
# nameless-deploy-tools (pyproject.toml)
# ec2-utils
# nitor-vault
boto3==1.35.58
boto3==1.35.60
# via
# nameless-deploy-tools (pyproject.toml)
# threadlocal-aws
botocore==1.35.58
botocore==1.35.60
# via
# boto3
# s3transfer
Expand All @@ -34,19 +33,15 @@ coverage==7.6.4
# nameless-deploy-tools (pyproject.toml)
# pytest-cov
cryptography==43.0.3
# via
# nitor-vault
# pyopenssl
# via pyopenssl
decorator==5.1.1
# via retry
docutils==0.21.2
# via readme-renderer
ec2-utils==0.38
# via nameless-deploy-tools (pyproject.toml)
future==1.0.0
# via
# ec2-utils
# nitor-vault
# via ec2-utils
idna==3.10
# via requests
importlib-metadata==8.5.0
Expand Down Expand Up @@ -83,7 +78,7 @@ netifaces==0.11.0
# via ec2-utils
nh3==0.2.18
# via readme-renderer
nitor-vault==0.56
nitor-vault==2.2.0
# via nameless-deploy-tools (pyproject.toml)
packaging==24.2
# via
Expand Down Expand Up @@ -145,7 +140,6 @@ requests==2.32.3
# via
# nameless-deploy-tools (pyproject.toml)
# ec2-utils
# nitor-vault
# requests-toolbelt
# threadlocal-aws
# twine
Expand All @@ -163,7 +157,7 @@ s3transfer==0.10.3
# via boto3
scandir==1.10.0
# via nameless-deploy-tools (pyproject.toml)
setuptools==75.4.0
setuptools==75.5.0
# via
# nameless-deploy-tools (pyproject.toml)
# pip-tools
Expand All @@ -174,9 +168,7 @@ termcolor==2.5.0
# nameless-deploy-tools (pyproject.toml)
# ec2-utils
threadlocal-aws==0.11
# via
# ec2-utils
# nitor-vault
# via ec2-utils
twine==5.1.1
# via nameless-deploy-tools (pyproject.toml)
urllib3==2.2.3
Expand Down
21 changes: 2 additions & 19 deletions faster_register_complete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,8 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=./common.sh
source "$DIR/common.sh"

ARGS=(-std=c++20 -O3 -Wall -Wextra)

if [ "$BASH_PLATFORM" = mac ]; then
# 03/2023:
# try to use brew llvm / Clang since it is newer than what Apple includes.
# Critically, Clang 14 does not yet support `march` compiler option for Apple Silicon,
# but brew llvm comes with Clang 15 that does support it so we can get the full benefit from the C++ code.
# This can be removed once macOS comes with Clang 15 by default...
if [ -e "$(brew --prefix)/opt/llvm/bin/clang++" ]; then
COMPILER="$(brew --prefix)/opt/llvm/bin/clang++"
ARGS+=(-march=native -mtune=native)
else
echo "You might want to install the latest Clang from brew ('brew install llvm') to get the best results..."
COMPILER="g++"
fi
else
COMPILER="g++"
ARGS+=(-march=native -mtune=native)
fi
ARGS=(-std=c++20 -O3 -Wall -Wextra -march=native -mtune=native)
COMPILER="g++"

if [ -n "$(command -v nameless-dt-register-complete)" ]; then
print_yellow "Overwriting existing script: nameless-dt-register-complete"
Expand Down
15 changes: 8 additions & 7 deletions n_utils/aws_infra_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,11 @@ def _resolve_ssm_parameter(ssm_key, region=None):


def _resolve_vault_parameter(vault_key):
value = None
if vault_key in vault_params:
value = vault_params[vault_key]
else:
value = Vault().lookup(vault_key)
vault_params[vault_key] = value
return vault_params[vault_key]

value = Vault().lookup(vault_key)
vault_params[vault_key] = value
return value


Expand Down Expand Up @@ -322,7 +321,6 @@ def _process_value(value, used_params):
def joined_file_lines(filename):
with open(filename) as f:
prevline = ""
to_yeild = None
for line in f.readlines():
if prevline.strip().endswith("\\"):
to_yeild = None
Expand Down Expand Up @@ -1004,6 +1002,7 @@ def param_refresh_callback():
elif isinstance(data, list):
for i in range(0, len(data)):
data[i] = _preprocess_template(data[i], root, basefile, path + str(i) + "_", template_params)

return data


Expand Down Expand Up @@ -1135,13 +1134,15 @@ def extract_script(prefix, path, join_args):

filename = encode_script_filename(prefix, path)
sys.stderr.write(prefix + ": Exported path '" + path + "' contents to file '" + filename + "'\n")
with open(filename, "w") as script_file: # opens file with name of "test.txt"
# opens file with name of "test.txt"
with open(filename, "w") as script_file:
script_file.write(code[0])
script_file.write("\n")
for var_name, var_decl in list(var_decls.items()):
script_file.write(var_decl)
script_file.write("\n")
script_file.write(code[1])

return filename


Expand Down
Loading