-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enumerate the OCI_ENV_PATH automatically. (#128)
The OCI_ENV_PATH is almost always the checkout directory of oci_env. Using python import paths and git commands, we can automatically determine the root path for the checkout. This alleviates the need to set the env var for most cases. [noissue] --------- Signed-off-by: James Tanner <[email protected]>
- Loading branch information
Showing
4 changed files
with
90 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -33,8 +33,8 @@ jobs: | |
- name: Set environment variables | ||
run: | | ||
echo "TEST=${{ matrix.TEST }}" >> $GITHUB_ENV | ||
echo "OCI_ENV_PATH=${GITHUB_WORKSPACE}/oci_env/" >> $GITHUB_ENV | ||
echo "COMPOSE_INTERACTIVE_NO_CLI=1" >> $GITHUB_ENV | ||
#echo "OCI_ENV_PATH=${GITHUB_WORKSPACE}/oci_env/" >> $GITHUB_ENV | ||
- name: clone pulpcore, pulp_file, pulp-openapi-generator | ||
run: | | ||
|
@@ -62,10 +62,6 @@ jobs: | |
sudo dpkg -i containernetworking-plugins_1.1.1+ds1-1_amd64.deb | ||
fi | ||
- name: (Ubuntu) Install docker compose | ||
if: matrix.TEST == 'docker' && matrix.os == 'ubuntu-latest' | ||
uses: docker-practice/[email protected] | ||
|
||
- name: (Mac) Install docker compose | ||
if: matrix.TEST == 'docker' && matrix.os == 'macos-12' | ||
uses: docker-practice/[email protected] | ||
|
This file contains 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,46 @@ | ||
# logger.py - reimplement some functionality of logzero | ||
|
||
import logging | ||
import os | ||
|
||
# Define ANSI escape codes for different colors | ||
ANSI_RESET = "\033[0m" | ||
ANSI_RED = "\033[31m" | ||
ANSI_GREEN = "\033[32m" | ||
ANSI_YELLOW = "\033[33m" | ||
ANSI_CYAN = "\033[36m" | ||
|
||
|
||
# unique color per level | ||
LOG_LEVEL_COLORS = { | ||
'DEBUG': ANSI_CYAN, | ||
'INFO': ANSI_GREEN, | ||
'WARNING': ANSI_YELLOW, | ||
'ERROR': ANSI_RED, | ||
'CRITICAL': ANSI_RED, | ||
} | ||
|
||
|
||
# need a custom class to have color per level | ||
class LogColor(logging.LogRecord): | ||
def __init__(self, *args, **kwargs): | ||
super(LogColor, self).__init__(*args, **kwargs) | ||
self.log_color = LOG_LEVEL_COLORS[self.levelname] | ||
self.reset = ANSI_RESET | ||
|
||
|
||
formatter = logging.Formatter('%(asctime)s - %(log_color)s%(levelname)s%(reset)s - %(filename)s:%(lineno)d - %(message)s') | ||
logging.setLogRecordFactory(LogColor) | ||
logger = logging.getLogger('oci_env') | ||
logger.setLevel(logging.INFO) | ||
console_handler = logging.StreamHandler() | ||
console_handler.setFormatter(formatter) | ||
|
||
|
||
if os.environ.get("OCI_ENV_DEBUG"): | ||
logger.setLevel(logging.DEBUG) | ||
console_handler.setLevel(logging.DEBUG) | ||
|
||
|
||
# Add the console handler to the logger | ||
logger.addHandler(console_handler) |
This file contains 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 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