Skip to content

Commit

Permalink
CI: Ensure we run from a built package instead of source
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausHolbechArista committed Nov 13, 2024
1 parent 461a3b7 commit edd4c29
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
6 changes: 1 addition & 5 deletions .github/requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Installing PyAVD from source.
# The package path below is relative to the repo root and will only work if the pip install is executed from there.
./python-avd
# The -r path is relative to this file.
-r ../ansible_collections/arista/avd/requirements.txt
# Needed for molecule
jsonschema-rs>=0.24
./python-avd[ansible-collection]
7 changes: 7 additions & 0 deletions .github/workflows/new-cvp-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ on: workflow_dispatch

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}

env:
# Set -vvv is ACTIONS_STEP_DEBUG is set
# Apparently it is set in secrets when running with debug
ANSIBLE_VERBOSITY: ${{ secrets.ACTIONS_STEP_DEBUG && 3 || 0 }}
AVD_NEVER_RUN_FROM_SOURCE: 1

jobs:
# ----------------------------------------------- #
# CV INTEGRATION MOLECULE TEST FOR CV_WORKFLOW #
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull-request-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
# Set -vvv is ACTIONS_STEP_DEBUG is set
# Apparently it is set in secrets when running with debug
ANSIBLE_VERBOSITY: ${{ secrets.ACTIONS_STEP_DEBUG && 3 || 0 }}
AVD_NEVER_RUN_FROM_SOURCE: 1

jobs:
file-changes:
Expand Down
3 changes: 2 additions & 1 deletion ansible_collections/arista/avd/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from __future__ import annotations

from contextlib import suppress
from os import environ
from pathlib import Path

PYTHON_AVD_PATH = Path(__file__).parents[4] / "python-avd"
RUNNING_FROM_SOURCE_PATH = PYTHON_AVD_PATH / "pyavd/running_from_src.txt"
RUNNING_FROM_SOURCE = RUNNING_FROM_SOURCE_PATH.exists()
RUNNING_FROM_SOURCE = RUNNING_FROM_SOURCE_PATH.exists() and not environ.get("AVD_NEVER_RUN_FROM_SOURCE")

if RUNNING_FROM_SOURCE:
import sys
Expand Down
3 changes: 2 additions & 1 deletion python-avd/pyavd/constants.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
from os import environ
from pathlib import Path

RUNNING_FROM_SRC = Path(__file__).parent.joinpath("running_from_src.txt").exists()
RUNNING_FROM_SRC = Path(__file__).parent.joinpath("running_from_src.txt").exists() and not environ.get("AVD_NEVER_RUN_FROM_SOURCE")
EOS_CLI_CONFIG_GEN_SCHEMA_ID = "eos_cli_config_gen"
EOS_DESIGNS_SCHEMA_ID = "eos_designs"
EOS_CLI_CONFIG_GEN_JINJA2_CONFIG_TEMPLATE = "eos-intended-config.j2"
Expand Down

0 comments on commit edd4c29

Please sign in to comment.