-
Notifications
You must be signed in to change notification settings - Fork 35
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
Various cleanups #587
Merged
Merged
Various cleanups #587
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
eda2212
Stop setting `$CONTAINER_HOST`
allisonkarlitskaya c115892
tasks: Disable SELinux for run-local.sh
martinpitt 8188adb
tasks: Use $COCKPIT_IMAGE_STORES_FILE
martinpitt 8e5b582
Replace tabs with spaces
martinpitt 4c188bf
workflows: Skip container rebuild for some more files
martinpitt 5298e55
workflows: Replace deprecated :set-output
martinpitt f514823
tasks: Better protect user's GitHub token in run-local.sh
martinpitt 42b67ea
tasks: Strengthen log assertions and adjust for job-runner
martinpitt 1f97a73
tasks: Fix typo in run-local.sh
martinpitt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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 |
---|---|---|
|
@@ -87,12 +87,8 @@ EOF | |
(mkdir -p webhook; cd webhook; $MYDIR/credentials/webhook/generate.sh) | ||
(mkdir -p tasks; cd tasks; $ROOTDIR/local-s3/generate-s3-cert.sh) | ||
|
||
# dummy token | ||
if [ -z "$TOKEN" ]; then | ||
echo 0123abc > webhook/.config--github-token | ||
else | ||
cp -fv "$TOKEN" webhook/.config--github-token | ||
fi | ||
# default to dummy token, tests need to opt into real one | ||
echo 0123abc > webhook/.config--github-token | ||
|
||
# minio S3 key | ||
mkdir tasks/s3-keys | ||
|
@@ -123,23 +119,26 @@ launch_containers() { | |
|
||
# start podman and run RabbitMQ in the background | ||
podman run -d --name cockpituous-rabbitmq --pod=new:cockpituous \ | ||
--security-opt=label=disable \ | ||
--publish $IMAGE_PORT:8080 \ | ||
--publish $S3_PORT:9000 \ | ||
--publish 9001:9001 \ | ||
-v "$RABBITMQ_CONFIG":/etc/rabbitmq:ro,z \ | ||
-v "$SECRETS"/webhook:/run/secrets/webhook:ro,z \ | ||
-v "$RABBITMQ_CONFIG":/etc/rabbitmq:ro \ | ||
-v "$SECRETS"/webhook:/run/secrets/webhook:ro \ | ||
docker.io/rabbitmq | ||
|
||
# S3 | ||
local admin_password="$(dd if=/dev/urandom bs=10 count=1 status=none | base64)" | ||
podman run -d --name cockpituous-s3 --pod=cockpituous \ | ||
--security-opt=label=disable \ | ||
-e MINIO_ROOT_USER="minioadmin" \ | ||
-e MINIO_ROOT_PASSWORD="$admin_password" \ | ||
-v "$SECRETS"/tasks/s3-server.key:/root/.minio/certs/private.key:ro \ | ||
-v "$SECRETS"/tasks/s3-server.pem:/root/.minio/certs/public.crt:ro \ | ||
quay.io/minio/minio server /data --console-address :9001 | ||
# wait until it started, create bucket | ||
podman run -d --interactive --name cockpituous-mc --pod=cockpituous \ | ||
--security-opt=label=disable \ | ||
-v "$SECRETS"/ca.pem:/etc/pki/ca-trust/source/anchors/ca.pem:ro \ | ||
--entrypoint /bin/sh quay.io/minio/mc | ||
read s3user s3key < "$SECRETS/tasks/s3-keys/localhost.localdomain" | ||
|
@@ -160,7 +159,8 @@ EOF | |
if [ -n "$INTERACTIVE" ]; then | ||
[ -z "$TOKEN" ] || cp -fv "$TOKEN" "$SECRETS"/webhook/.config--github-token | ||
podman run -d --name cockpituous-webhook --pod=cockpituous --user user \ | ||
-v "$SECRETS"/webhook:/run/secrets/webhook:ro,z \ | ||
--security-opt=label=disable \ | ||
-v "$SECRETS"/webhook:/run/secrets/webhook:ro \ | ||
--env=AMQP_SERVER=$AMQP_POD \ | ||
--env=COCKPIT_GITHUB_TOKEN_FILE=/run/secrets/webhook/.config--github-token \ | ||
--env=COCKPIT_GITHUB_WEBHOOK_TOKEN_FILE=/run/secrets/webhook/.config--github-webhook-token \ | ||
|
@@ -174,13 +174,13 @@ EOF | |
sleep 3 | ||
done | ||
|
||
# Run tasks container in the backgroud | ||
# Run tasks container in the background | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh. Good :) |
||
# use bash as pid 1 to mop up zombies | ||
podman run -d -it --name cockpituous-tasks --pod=cockpituous \ | ||
-v "$SECRETS"/tasks:/run/secrets/tasks:ro,z \ | ||
-v "$SECRETS"/webhook:/run/secrets/webhook:ro,z \ | ||
--security-opt=label=disable \ | ||
-v "$SECRETS"/tasks:/run/secrets/tasks:ro \ | ||
-v "$SECRETS"/webhook:/run/secrets/webhook:ro \ | ||
-v "${XDG_RUNTIME_DIR:-/run}/podman/podman.sock:/podman.sock" \ | ||
--env=CONTAINER_HOST=unix:///podman.sock \ | ||
--env=COCKPIT_GITHUB_TOKEN_FILE=/run/secrets/webhook/.config--github-token \ | ||
--env=COCKPIT_CA_PEM=/run/secrets/webhook/ca.pem \ | ||
--env=COCKPIT_BOTS_REPO=${COCKPIT_BOTS_REPO:-} \ | ||
|
@@ -200,7 +200,7 @@ EOF | |
cleanup_containers() { | ||
echo "Cleaning up..." | ||
|
||
# clean up dummy token, so that image-prune does not try to use it | ||
# clean up token, so that image-prune does not try to use it | ||
rm "$SECRETS"/webhook/.config--github-token | ||
|
||
# revert podman socket permission change | ||
|
@@ -281,7 +281,8 @@ test_mock_pr() { | |
echo "--------------- mock PR test log -----------------" | ||
echo "$LOG" | ||
echo "--------------- mock PR test log end -------------" | ||
assert_in 'Test run finished' "$LOG" | ||
assert_in 'Test run finished, return code: 0\|Job ran successfully' "$LOG" | ||
assert_in 'Running on:.*cockpituous' "$LOG" | ||
} | ||
|
||
test_pr() { | ||
|
@@ -331,7 +332,7 @@ test_pr() { | |
echo "--------------- test log end -------------" | ||
assert_in '<html>' "$LOG_HTML" | ||
assert_in 'Running on:.*cockpituous' "$LOG" | ||
assert_in 'Test run finished, return code: 0' "$LOG" | ||
assert_in 'Test run finished, return code: 0\|Job ran successfully' "$LOG" | ||
# validate test attachment if we ran cockpituous' own tests | ||
if [ "${PR_REPO%/cockpituous}" != "$PR_REPO" ]; then | ||
BOGUS_LOG=$($CURL ${LOG_URL%/log}/bogus.log) | ||
|
@@ -348,9 +349,9 @@ test_queue() { | |
test_podman() { | ||
# tasks can connect to host's podman service | ||
# this will be covered implicitly by job-runner, but as a more basal plumbing test this is easier to debug | ||
out="$(podman exec -i cockpituous-tasks podman-remote ps)" | ||
out="$(podman exec -i cockpituous-tasks podman-remote --url unix:///podman.sock ps)" | ||
assert_in 'cockpituous-tasks' "$out" | ||
out="$(podman exec -i cockpituous-tasks podman-remote run -it --rm quay.io/cockpit/tasks:latest whoami)" | ||
out="$(podman exec -i cockpituous-tasks podman-remote --url unix:///podman.sock run -it --rm quay.io/cockpit/tasks:latest whoami)" | ||
assert_in '^user' "$out" | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we ever resolved what we want to do about this path, but I actually don't care. It's not really API.