-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1df37f9
commit 66a63cf
Showing
8 changed files
with
167 additions
and
3 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
logs |
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 @@ | ||
*.yml |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ Cargo.lock | |
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
.env | ||
.secrets | ||
*~ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
#Run workflows locally using act | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
WORKFLOW_FILE="${SCRIPT_DIR}/../.github/workflows/ci.yml" | ||
SECRETS_FILE="${SCRIPT_DIR}/../.secrets" | ||
|
||
if [ ! -f "${SECRETS_FILE}" ]; then | ||
echo "No file '${SECRETS_FILE}' found. Please create one. It must have the following keys: | ||
GITHUB_TOKEN" \ | ||
"You can find your GitHub token with 'gh auth token'" | ||
exit 1 | ||
fi | ||
|
||
if ! command -v act &>/dev/null; then | ||
echo "act must be installed! Install at https://github.com/nektos/act" | ||
exit 1 | ||
fi | ||
|
||
if ! command -v unbuffer &>/dev/null; then | ||
echo "unbuffer must be installed! Install 'expect' from your package manager" | ||
exit 1 | ||
fi | ||
|
||
populate_env_file() { | ||
ENV_FILE="${1}" | ||
echo "Attempting automatic configuration of proxy with ENV_FILE=${ENV_FILE}" | ||
|
||
if [ -z "${HTTP_PROXY}" ] && [ -f ~/.docker/config.json ]; then | ||
HTTP_PROXY=$(grep httpProxy ~/.docker/config.json | awk -F'\"[:space:]*:[:space:]*' '{split($2,a,"\""); print a[2]}') | ||
echo "Exported docker config HTTP_PROXY=${HTTP_PROXY}" | ||
elif [ -n "${HTTP_PROXY}" ]; then | ||
echo "Exported docker config HTTP_PROXY=${HTTP_PROXY}" | ||
fi | ||
echo "HTTP_PROXY=${HTTP_PROXY}" >>"${ENV_FILE}" | ||
echo "proxy=${HTTP_PROXY}" >>"${ENV_FILE}" | ||
|
||
if [ -z "${HTTPS_PROXY}" ] && [ -f ~/.docker/config.json ]; then | ||
HTTPS_PROXY=$(grep httpsProxy ~/.docker/config.json | awk -F'\"[:space:]*:[:space:]*' '{split($2,a,"\""); print a[2]}') | ||
echo "Exported docker config HTTPS_PROXY=${HTTPS_PROXY}" | ||
elif [ -n "${HTTPS_PROXY}" ]; then | ||
echo "Exported docker config HTTPS_PROXY=${HTTPS_PROXY}" | ||
fi | ||
echo "HTTPS_PROXY=${HTTPS_PROXY}" >>"${ENV_FILE}" | ||
|
||
if [ -z "${http_proxy}" ] && [ -f ~/.docker/config.json ]; then | ||
http_proxy=$(grep httpProxy ~/.docker/config.json | awk -F'\"[:space:]*:[:space:]*' '{split($2,a,"\""); print a[2]}') | ||
echo "Exported docker config http_proxy=${http_proxy}" | ||
elif [ -n "${http_proxy}" ]; then | ||
echo "Exported docker config http_proxy=${http_proxy}" | ||
fi | ||
echo "http_proxy=${http_proxy}" >>"${ENV_FILE}" | ||
|
||
if [ -z "${https_proxy}" ] && [ -f ~/.docker/config.json ]; then | ||
https_proxy=$(grep httpsProxy ~/.docker/config.json | awk -F'\"[:space:]*:[:space:]*' '{split($2,a,"\""); print a[2]}') | ||
echo "Exported docker config https_proxy=${https_proxy}" | ||
elif [ -n "${https_proxy}" ]; then | ||
echo "Exported docker config https_proxy=${https_proxy}" | ||
fi | ||
echo "https_proxy=${https_proxy}" >>"${ENV_FILE}" | ||
|
||
if [ -z "${NO_PROXY}" ] && [ -f ~/.docker/config.json ]; then | ||
NO_PROXY=$(grep noProxy ~/.docker/config.json | awk -F'\"[:space:]*:[:space:]*' '{split($2,a,"\""); print a[2]}') | ||
echo "Exported docker config NO_PROXY=${NO_PROXY}" | ||
elif [ -n "${NO_PROXY}" ]; then | ||
echo "Exported docker config NO_PROXY=${NO_PROXY}" | ||
fi | ||
echo "NO_PROXY=${NO_PROXY}" >>"${ENV_FILE}" | ||
|
||
cat "${ENV_FILE}" | ||
} | ||
|
||
ENV_FILE=$(mktemp) | ||
ARTIFACT_DIR=$(mktemp -d) | ||
populate_env_file "${ENV_FILE}" | ||
mkdir -p "${SCRIPT_DIR}/../.github/logs/" | ||
unbuffer act -W "${WORKFLOW_FILE}" --env-file="${ENV_FILE}" --secret-file="${SECRETS_FILE}" \ | ||
--artifact-server-path "${ARTIFACT_DIR}" \ | ||
"$@" | tee "${SCRIPT_DIR}/../.github/logs/$(date '+%F-%T').log" | ||
rm "${ENV_FILE}" |
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,20 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# sudo -E dnf install -y cloud-utils | ||
|
||
mkdir -p .github/rsrc/ | ||
# password is "password" | ||
# mkpasswd --method=SHA-512 --rounds=4096 | ||
PASSWD="$6$rounds=4096$EhaOFVl.Hr626Zg2$mIqOEWTXg0U4cfIDDsYYLtqNMoCLRMVQfX4iZnlQTt.dnBoXetHdMzyGdY2MVOWGV18UowbFNSJowTHmBDb4z1" | ||
cat <<EOF > .github/rsrc/user-data.yml | ||
users: | ||
- name: user | ||
passwd: ${PASSWD} | ||
lock_passwd: false | ||
groups: [sudo] | ||
shell: /bin/bash | ||
EOF | ||
|
||
cloud-localds .github/rsrc/seed.img .github/rsrc/user-data.yml |