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

feature(git-actions): new action to test hydra on macos #9607

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
21 changes: 21 additions & 0 deletions .github/workflows/test-hydra-macos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
pull_request:
branches:
- master
jobs:
test:
runs-on: macos-13
env:
AWS_ACCESS_KEY_ID: ${{ secrets.QA_USER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.QA_USER_AWS_SECRET_ACCESS_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Docker
uses: douglascamata/setup-docker-macos-action@v1-alpha
- run: |
#!/usr/bin/env bash -x
AWS_OPTIONS=$(env | sed -n 's/\(AWS_.*\)=.*/--env \1/p')
echo $AWS_OPTIONS
- name: Run Hydra
run: bash -x ./docker/env/hydra.sh list-images
14 changes: 7 additions & 7 deletions docker/env/hydra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ if [[ -n "${CREATE_RUNNER_INSTANCE}" ]]; then
fi

# if running on Build server
if [[ ${USER} == "jenkins" ]]; then
if [[ ${USER} == "jenkins" || ${USER} == "runner" ]]; then
echo "Running on Build Server..."
HOST_NAME=`hostname`
else
Expand All @@ -173,7 +173,7 @@ else
die "Please make sure you install either podman or docker on this machine to run hydra"
fi

if [[ ${USER} == "jenkins" || -z "`$tool images ${DOCKER_REPO}:${VERSION} -q`" ]]; then
if [[ ${USER} == "jenkins" || ${USER} == "runner" || -z "`$tool images ${DOCKER_REPO}:${VERSION} -q`" ]]; then
echo "Pull version $VERSION from Docker Hub..."
$tool pull ${DOCKER_REGISTRY}/${DOCKER_REPO}:${VERSION}
else
Expand All @@ -190,19 +190,19 @@ fi
DOCKER_ADD_HOST_ARGS=()

# export all SCT_* env vars into the docker run
SCT_OPTIONS=$(env | sed -n 's/^\(SCT_[^=]\+\)=.*/--env \1/p')
SCT_OPTIONS=$(env | sed -n 's/\(SCT_.*\)=.*/--env \1/p')

# export all PYTEST_* env vars into the docker run
PYTEST_OPTIONS=$(env | sed -n 's/^\(PYTEST_[^=]\+\)=.*/--env \1/p')
PYTEST_OPTIONS=$(env | sed -n 's/\(PYTEST_.*\)=.*/--env \1/p')

# export all BUILD_* env vars into the docker run
BUILD_OPTIONS=$(env | sed -n 's/^\(BUILD_[^=]\+\)=.*/--env \1/p')
BUILD_OPTIONS=$(env | sed -n 's/\(BUILD_.*\)=.*/--env \1/p')

# export all AWS_* env vars into the docker run
AWS_OPTIONS=$(env | sed -n 's/^\(AWS_[^=]\+\)=.*/--env \1/p')
AWS_OPTIONS=$(env | sed -n 's/\(AWS_.*\)=.*/--env \1/p')

# export all JENKINS_* env vars into the docker run
JENKINS_OPTIONS=$(env | sed -n 's/^\(JENKINS_[^=]\+\)=.*/--env \1/p')
JENKINS_OPTIONS=$(env | sed -n 's/\(JENKINS_.*\)=.*/--env \1/p')

is_podman="$($tool --help | { grep -o podman || :; })"
docker_common_args=()
Expand Down
1 change: 1 addition & 0 deletions sdcm/utils/aws_okta.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def can_get_to_aws_account():
assert response['Account'] == account_id
LOGGER.info("logged in as %s", response['Arn'])
except (NoCredentialsError, AssertionError):
LOGGER.exception("failed")
return False
return True

Expand Down
2 changes: 1 addition & 1 deletion sdcm/utils/get_username.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_username() -> str: # pylint: disable=too-many-return-statements # noqa
return user_id

current_linux_user = getpass.getuser()
if current_linux_user == "jenkins":
if current_linux_user in ["jenkins", "runner"]:
return current_linux_user
if current_linux_user == "ubuntu":
return "sct-runner"
Expand Down
Loading