Skip to content

Commit

Permalink
[soil] Print Soil URLs again after updating server state
Browse files Browse the repository at this point in the history
This is so contributors can find the logs!

This was "broken" by the SSH -> HTTP conversion, which introduced a lot
more spew.

---

TODO: I also noticed that we aren't cleaning up the status API.  There
are over a thousand directories there.
  • Loading branch information
Andy C committed Jan 13, 2025
1 parent e3f348b commit 4e185bc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
17 changes: 10 additions & 7 deletions soil/github-actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ publish-html-assuming-ssh-key() {
local update_status_api=${2:-}

if true; then
local prefix='github-'
local run_dir=$GITHUB_RUN_NUMBER
# https://docs.github.com/en/actions/reference/environment-variables

# Recommended by the docs
Expand All @@ -30,7 +32,8 @@ publish-html-assuming-ssh-key() {
# Note $GITHUB_RUN_NUMBER is a different sequence for all-builds.yml vs.
# fast-subset.yml

soil/web-worker.sh deploy-job-results 'github-' $GITHUB_RUN_NUMBER $job_name \
# This function prints 'View CI results here:' with URLs to op.oilshell.org
soil/web-worker.sh deploy-job-results $prefix $run_dir $job_name \
JOB_URL \
GITHUB_WORKFLOW \
GITHUB_RUN_ID \
Expand All @@ -46,12 +49,15 @@ publish-html-assuming-ssh-key() {
fi

# Calls rewrite-jobs-index and cleanup-jobs-index
time soil/web-worker.sh remote-event-job-done 'github-' $GITHUB_RUN_NUMBER
time soil/web-worker.sh remote-event-job-done $prefix $run_dir

if test -n "$update_status_api"; then
soil/web-worker.sh scp-status-api "$GITHUB_RUN_ID" "$job_name"
soil/web-worker.sh remote-cleanup-status-api
fi

# Show URLs again, so users can find the logs
soil/web-worker.sh show-soil-urls $prefix $run_dir $job_name
}

# Notes on Github secrets:
Expand Down Expand Up @@ -116,9 +122,6 @@ run-job() {
local job_name=$1
local docker=${2:-docker}

# I think it starts in the repo
# cd $REPO_ROOT

soil/host-shim.sh mount-perms $REPO_ROOT
echo
echo
Expand All @@ -127,15 +130,15 @@ run-job() {
}

publish-and-exit() {
### Called by YAML config
### Called by Github Actions YAML config
local job_name=$1
# second param is passed to publish-html

# Unlike sourcehut, Github Actions runs one job per machine. So we publish
# HTML and exit in one step.

publish-html "$@"

# Look on disk to see if all jobs suceeded
soil/host-shim.sh did-all-succeed $job_name
}

Expand Down
13 changes: 12 additions & 1 deletion soil/web-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@ deploy-job-results() {
local prefix=$1 # e.g. github- for example.com/github-jobs/
local run_dir=$2 # e.g. 1234 # make this dir
local job_name=$3 # e.g. cpp-small for example.com/github-jobs/1234/cpp-small.wwz
shift 2

# rest of args are more env vars
shift 3

# writes $job_name.wwz
make-job-wwz $job_name
Expand Down Expand Up @@ -311,6 +312,16 @@ deploy-job-results() {
$WWUP_URL
fi

show-soil-urls $prefix $run_dir $job_name
}

show-soil-urls() {
# Same args as deploy-job-results

local prefix=$1 # e.g. github- for example.com/github-jobs/
local run_dir=$2 # e.g. 1234 # make this dir
local job_name=$3 # e.g. cpp-small for example.com/github-jobs/1234/cpp-small.wwz

log ''
log 'View CI results here:'
log ''
Expand Down
4 changes: 3 additions & 1 deletion soil/web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ cleanup-status-api() {
ls | head -n -30 | xargs --no-run-if-empty -- rm -r -f -v
;;
true)
ls | head -n -30
# TODO: fix spew
#ls | head -n -30
ls | head
;;
*)
log 'Expected true or false for dry_run'
Expand Down

0 comments on commit 4e185bc

Please sign in to comment.