Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"[just]": {
"editor.defaultFormatter": "TobiasHochguertel.just-formatter"
},
"[robotframework]": {
"editor.defaultFormatter": "d-biehl.robotcode",
},
"python-envs.defaultEnvManager": "ms-python.python:system",
"coverage-gutters.showGutterCoverage": true,
"coverage-gutters.showLineCoverage": true,
Expand Down
60 changes: 49 additions & 11 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "2.0.0",
"tasks": [
{
"label": "packtly_builder_tooling",
"label": "container: tooling just recipe",
"type": "shell",
"command": "just",
"args": [
Expand All @@ -15,15 +15,7 @@
"problemMatcher": []
},
{
"label": "run robot tests",
"type": "shell",
"command": "${workspaceFolder}/test/robot/run.sh",
"problemMatcher": [
"$python"
]
},
{
"label": "packtly_build_full",
"label": "container: tooling full",
"type": "shell",
"command": "/opt/venv/bin/python",
"args": [
Expand All @@ -41,7 +33,7 @@
"problemMatcher": []
},
{
"label": "packtly_upload",
"label": "container: tooling upload",
"type": "shell",
"command": "/opt/venv/bin/python",
"args": [
Expand All @@ -59,6 +51,26 @@
"cwd": "${workspaceFolder}/packtly-builder/tooling"
},
"problemMatcher": []
},
{
"label": "host: run robot tests",
"type": "shell",
"command": "${workspaceFolder}/test/robot/run.sh",
"problemMatcher": [
"$python"
]
},
{
"label": "host: run just recipe",
"type": "shell",
"command": "just",
"args": [
"${input:justRecipeHost}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
],
"inputs": [
Expand All @@ -77,6 +89,32 @@
"test_keys"
],
"default": "default"
},
{
"id": "justRecipeHost",
"type": "pickString",
"description": "Choose a top-level just recipe to run on the host",
"options": [
"all",
"build-base",
"build-builder",
"build-builder-multiarch",
"build-devcontainer",
"build-runtime",
"build-runtime-multiarch",
"build-tooling",
"clean",
"clean-base",
"clean-builder",
"clean-containers",
"clean-devcontainer",
"clean-runtime",
"install-robocop",
"lint-robot",
"test-tooling",
"test-tooling-keys"
],
"default": "default"
}
]
}
14 changes: 14 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,20 @@ shell: _require-tools
exit "$rc"
fi

# --- Robot Framework linting ---

# Install robocop linter (own pipx venv, independent of the RF test runner)
install-robocop:
#!/usr/bin/env bash
set -euo pipefail
if ! pipx list --short | grep -q 'robotframework-robocop'; then
pipx install robotframework-robocop
fi

# Lint Robot Framework files with robocop
lint-robot: install-robocop
robocop check test/robot

# --- Pipeline ---

clean: _require-tools
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
*** Settings ***
Documentation Keywords for generating Aptly credentials used in integration tests.
Library OperatingSystem


*** Keywords ***
Generate Aptly Credentials
[Arguments]
... ${path}
[Documentation] Generate a simple aptly credentials file
[Arguments] ${path}
... ${username}=admin
... ${password}=password

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
*** Settings ***
Documentation Keywords for interacting with Git repositories in integration tests.
Library Process


*** Keywords ***
Checkout Repository
[Documentation] Checkout a git repository to a given path.
[Arguments] ${url} ${path} ${branch}=main

${result}= Run Process
Expand Down
69 changes: 69 additions & 0 deletions test/robot/keywords/gpg.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
*** Settings ***
Documentation Keywords for generating GPG key pairs used to sign and verify Debian packages in integration tests.
Library OperatingSystem
Library Process
Library String


*** Variables ***
${GEN_GPG_SCRIPT} ${EMPTY}
${GPG_NAME} packtly-test
${GPG_EMAIL} test@packtly.local
${GPG_PASS} test1234


*** Keywords ***
Get Gen GPG Script
[Documentation] Return the absolute path to the gen_gpg helper script in the repository.
${result}= Run Process git rev-parse --show-toplevel
Should Be Equal As Integers ${result.rc} 0 ${result.stderr}
${topdir}= Strip String ${result.stdout}
RETURN ${topdir}/packtly-builder/containers/scripts/gen_gpg

Generate GPG Keys
[Documentation] Generate a GPG key pair inside the build container and export its files.
... The public and private keys are written to ${keys_dir}.
[Arguments] ${keys_dir}
... ${image}

VAR ${gpg_out} ${keys_dir}/_gpg_out
${gen_gpg}= Get Gen GPG Script

Prepare GPG Key Directories ${keys_dir} ${gpg_out}
Run GPG Generator ${gen_gpg} ${gpg_out} ${image}
Export GPG Keys ${gpg_out} ${keys_dir}
Remove Directory ${gpg_out} recursive=True

Prepare GPG Key Directories
[Documentation] Create the public, private, and temporary GPG key directories.
[Arguments] ${keys_dir} ${gpg_out}

Create Directory ${keys_dir}/public
Create Directory ${keys_dir}/private
Create Directory ${gpg_out}

Run GPG Generator
[Documentation] Run the GPG generation helper in the specified build container.
[Arguments] ${gen_gpg} ${gpg_out} ${image}

${result}= Run Process
... podman run --rm
... --entrypoint /usr/local/bin/gen_gpg
... -v ${gen_gpg}:/usr/local/bin/gen_gpg:Z,ro
... -v ${gpg_out}:/opt/keys/gpg:Z
... ${image}
... --name ${GPG_NAME}
... --email ${GPG_EMAIL}
... --pass ${GPG_PASS}

Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0 ${result.stderr}

Export GPG Keys
[Documentation] Move generated GPG key material from the temporary directory to ${keys_dir}.
[Arguments] ${gpg_out} ${keys_dir}

Move File ${gpg_out}/repo_signing.key ${keys_dir}/public/repo_signing.key
Move File ${gpg_out}/repo_signing_private.key ${keys_dir}/private/repo_signing_private.key
Move File ${gpg_out}/repo_signing_private_pass ${keys_dir}/private/repo_signing_private_pass
48 changes: 0 additions & 48 deletions test/robot/keywords/gpg.robot

This file was deleted.

Loading