feat: update action.yml to use pwsh shell and enhance vm.py with start option; add credential management scripts
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/opt/ci/venv/bin/python
|
||||
"""Store a CI credential in the file keyring for ci-runner (two-entry scheme).
|
||||
|
||||
Usage:
|
||||
sudo -u ci-runner /opt/ci/venv/bin/python tools/ci-cred-set.py <target> [<username>]
|
||||
|
||||
Examples:
|
||||
sudo -u ci-runner /opt/ci/venv/bin/python tools/ci-cred-set.py BuildVMGuest "WINBUILD-2025\\ci_build"
|
||||
sudo -u ci-runner /opt/ci/venv/bin/python tools/ci-cred-set.py GiteaPAT ci-runner-linux
|
||||
"""
|
||||
import getpass
|
||||
import sys
|
||||
|
||||
try:
|
||||
import keyring
|
||||
except ImportError:
|
||||
sys.exit("keyring not installed")
|
||||
|
||||
target = sys.argv[1] if len(sys.argv) > 1 else "BuildVMGuest"
|
||||
username = sys.argv[2] if len(sys.argv) > 2 else input(f"Username for {target}: ")
|
||||
password = getpass.getpass(f"Password for {target}/{username}: ")
|
||||
|
||||
# Entry 1: password, keyed by (service=target, username=username)
|
||||
keyring.set_password(target, username, password)
|
||||
# Entry 2: username stored separately so get_credential(target, None) can find it
|
||||
keyring.set_password(f"{target}:meta", "username", username)
|
||||
|
||||
print(f"Stored: service={target!r} username={username!r}")
|
||||
Reference in New Issue
Block a user