diff --git a/.github/workflows/all-builds.yml b/.github/workflows/all-builds.yml index bb3449b3b3..131b6c7e23 100644 --- a/.github/workflows/all-builds.yml +++ b/.github/workflows/all-builds.yml @@ -45,9 +45,6 @@ jobs: soil/worker.sh JOB-raw-vm - name: publish-html - env: - # for deploying to dashboard - OILS_GITHUB_KEY: ${{ secrets.OILS_GITHUB_KEY }} run: | soil/github-actions.sh publish-and-exit raw-vm T @@ -85,9 +82,6 @@ jobs: soil/github-actions.sh run-job dummy podman - name: publish-html - env: - # for deploying to dashboard - OILS_GITHUB_KEY: ${{ secrets.OILS_GITHUB_KEY }} run: | soil/github-actions.sh publish-and-exit dummy T @@ -412,9 +406,6 @@ jobs: soil/worker.sh JOB-maybe-merge - name: publish-html - env: - # for deploying to dashboard - OILS_GITHUB_KEY: ${{ secrets.OILS_GITHUB_KEY }} run: | # NOTE: does not publish to status API soil/github-actions.sh publish-and-exit maybe-merge diff --git a/.github/workflows/fast-subset.yml_DISABLED b/.github/workflows/fast-subset.yml_DISABLED new file mode 100644 index 0000000000..aa894cf0a4 --- /dev/null +++ b/.github/workflows/fast-subset.yml_DISABLED @@ -0,0 +1,122 @@ +# Soil wrapped in Github Actions. + +name: oil +on: + # We are running into the pitfall here + # https://fusectore.dev/2022/09/25/github-actions-pitfalls.html + # We only run for members now, not external contributors + # But I think their solution of push: branches: [soil-staging] would prevent + # us from testing dev / feature branches. We would have to create a PR + # first? + pull_request: + # Run on PR merge to soil-staging, so that it will get auto-merged to master + push: + branches: ['soil-staging'] + #push: + # branches: ['soil-staging', 'dev*', 'jesse*'] + # + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + # I think that is sufficient for dev branches. + + # don't run CI on master because we test soil-staging and auto-merge. + #push: + # branches-ignore: + # - master +env: + # Only set for PR runs. + # https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request + GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} + GITHUB_PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} + GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} +jobs: + # The perf tool depends on a specific version of a kernel, so run it outside + # a container. + raw-vm: + runs-on: ubuntu-22.04 + env: + REPO_ROOT: ${{ github.workspace }} + needs: ['cpp-tarball'] + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: raw-vm + run: | + soil/worker.sh JOB-raw-vm + + - name: publish-html + run: | + soil/github-actions.sh publish-and-exit raw-vm T + + dummy: + runs-on: ubuntu-22.04 + # container: oilshell/soil-dummy + env: + REPO_ROOT: ${{ github.workspace }} + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + # UPGRADED to podman + - name: dummy + run: | + soil/github-actions.sh run-job dummy podman + + - name: publish-html + run: | + soil/github-actions.sh publish-and-exit dummy T + + cpp-tarball: + runs-on: ubuntu-22.04 + env: + REPO_ROOT: ${{ github.workspace }} + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Fix kernel mmap rnd bits + # Asan in llvm 14 provided in ubuntu 22.04 is incompatible with + # high-entropy ASLR in much newer kernels that GitHub runners are + # using leading to random crashes: https://reviews.llvm.org/D148280 + run: sudo sysctl vm.mmap_rnd_bits=28 + + - name: cpp-tarball + run: | + soil/github-actions.sh run-job cpp-tarball + + # can't be done inside container + - name: publish-cpp-tarball + env: + # auth for web server + OILS_GITHUB_KEY: ${{ secrets.OILS_GITHUB_KEY }} + run: | + soil/github-actions.sh publish-cpp-tarball + + - name: publish-html + env: + OILS_GITHUB_KEY: ${{ secrets.OILS_GITHUB_KEY }} + run: | + soil/github-actions.sh publish-and-exit cpp-tarball T + + maybe-merge-to-master: + runs-on: ubuntu-22.04 + env: + REPO_ROOT: ${{ github.workspace }} + # List of tasks to wait on. Copied from soil/worker.sh list-jobs + needs: ['dummy', 'cpp-tarball', 'raw-vm'] + #needs: ['dummy', 'pea', 'other-tests'] + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: maybe-merge + env: + SOIL_GITHUB_API_TOKEN: ${{ secrets.SOIL_GITHUB_API_TOKEN }} + run: | + # STUBBED OUT + soil/worker.sh JOB-dummy + + - name: publish-html + run: | + # NOTE: does not publish to status API + soil/github-actions.sh publish-and-exit maybe-merge diff --git a/doc/release-quality.md b/doc/release-quality.md index 360d8c5e80..60320d5dfa 100644 --- a/doc/release-quality.md +++ b/doc/release-quality.md @@ -66,7 +66,7 @@ This is a supplement to the [main release page](index.html). - [osh-usage](more-tests.wwz/suite-logs/osh-usage.txt). Misc tests of the `osh` binary. - [tools-deps](more-tests.wwz/suite-logs/tools-deps.txt). Tests for a subcommand in progress. -- [syscall](more-tests.wwz/syscall/-wwz-index) How many syscalls do we make, +- [syscall](more-tests.wwz/syscall/-wwz-index). How many syscalls do we make, and how many processes do we start? - [ysh-ify Tests](more-tests.wwz/suite-logs/ysh-ify.txt). Test OSH to YSH translation. diff --git a/soil/README.md b/soil/README.md index e841744b36..0ee38d5486 100644 --- a/soil/README.md +++ b/soil/README.md @@ -29,7 +29,7 @@ Continuous testing on many platforms. cpp-small.{tsv,json} commits/ - srht-jobs/ + sourcehut-jobs/ index.html raw.html 345/ # JOB_ID @@ -106,7 +106,7 @@ TODO: - github-jobs/tmp-$$.{index,raw}.html - shell script does mv - github-jobs/commits/tmp-$$.$HASH.html - shell script does mv - this is based on github-jobs/$RUN/*.tsv -- similar to format-wwz-index - - or srht-jobs/*/*.tsv and filtered by commit + - or sourcehut-jobs/*/*.tsv and filtered by commit - github-jobs/tmp-$$.remove.txt - shell script does rm - status-api/github-jobs/$RUN/$job -- PUT this diff --git a/soil/admin.sh b/soil/admin.sh index 3b9a9de559..81badd4e4f 100755 --- a/soil/admin.sh +++ b/soil/admin.sh @@ -15,5 +15,14 @@ keygen() { ssh-keygen -t rsa -b 4096 -C "$comment" -f $file } +enable-fast-subset() { + git mv .github/workflows/all-builds.yml{,_DISABLED} + git mv .github/workflows/fast-subset.yml{_DISABLED,} +} + +disable-fast-subset() { + git mv .github/workflows/all-builds.yml{_DISABLED,} + git mv .github/workflows/fast-subset.yml{,_DISABLED} +} "$@" diff --git a/soil/common.sh b/soil/common.sh index c85d39b4c8..bb938a567f 100644 --- a/soil/common.sh +++ b/soil/common.sh @@ -22,9 +22,9 @@ dump-env() { if true; then readonly SOIL_USER='travis_admin' - readonly SOIL_HOST='travis-ci.oilshell.org' - readonly SOIL_HOST_DIR=~/travis-ci.oilshell.org # used on server - readonly SOIL_REMOTE_DIR=travis-ci.oilshell.org # used on client + readonly SOIL_HOST='ci.oilshell.org' + readonly SOIL_HOST_DIR=~/ci.oilshell.org # used on server + readonly SOIL_REMOTE_DIR=ci.oilshell.org # used on client elif false; then readonly SOIL_USER='oils' readonly SOIL_HOST='mb.oils.pub' @@ -40,6 +40,8 @@ fi readonly SOIL_USER_HOST="$SOIL_USER@$SOIL_HOST" +readonly WWUP_URL="https://$SOIL_HOST/uuu/wwup.cgi" + html-head() { # TODO: Shebang line should change too PYTHONPATH=. python3 doctools/html_head.py "$@" @@ -73,7 +75,7 @@ git-commit-dir() { local commit_hash commit_hash=$(cat _tmp/soil/commit-hash.txt) - local git_commit_dir="$SOIL_REMOTE_DIR/${prefix}jobs/git-$commit_hash" + local git_commit_dir="$SOIL_REMOTE_DIR/code/${prefix}jobs/git-$commit_hash" echo $git_commit_dir } @@ -85,8 +87,8 @@ git-commit-url() { local commit_hash commit_hash=$(cat _tmp/soil/commit-hash.txt) - # https:// not working on Github Actions? - local url="http://$SOIL_HOST/${prefix}jobs/git-$commit_hash" + # https:// not working on Github Actions because of cert issues? + local url="http://$SOIL_HOST/code/${prefix}jobs/git-$commit_hash" echo $url } diff --git a/soil/github-actions.sh b/soil/github-actions.sh index c2c97a05c7..62a009c796 100755 --- a/soil/github-actions.sh +++ b/soil/github-actions.sh @@ -27,6 +27,9 @@ publish-html-assuming-ssh-key() { # Recommended by the docs export JOB_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" + # 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 \ JOB_URL \ GITHUB_WORKFLOW \ @@ -85,7 +88,7 @@ load-secret-key() { publish-html() { ### Publish job HTML, and optionally status-api - load-secret-key + #load-secret-key set -x # $1 can be the job name diff --git a/soil/maybe-merge.sh b/soil/maybe-merge.sh index cab1bb2c2e..da01d22eeb 100755 --- a/soil/maybe-merge.sh +++ b/soil/maybe-merge.sh @@ -125,7 +125,7 @@ soil-run() { mkdir -p $dir # These tiny files are written by each Soil task - local url_base="http://$SOIL_HOST/status-api/github/$run_id" + local url_base="http://$SOIL_HOST/uuu/status-api/github/$run_id" #local jobs='dummy pea other-tests' # minimal set of jobs to wait for local jobs=$(soil/worker.sh list-jobs) diff --git a/soil/sourcehut.sh b/soil/sourcehut.sh index c00900fb16..43bddceb11 100755 --- a/soil/sourcehut.sh +++ b/soil/sourcehut.sh @@ -28,7 +28,7 @@ publish-html-assuming-ssh-key() { local job_name=$1 if true; then - soil/web-worker.sh deploy-job-results 'srht-' $JOB_ID $job_name JOB_ID JOB_URL + soil/web-worker.sh deploy-job-results 'sourcehut-' $JOB_ID $job_name JOB_ID JOB_URL else soil/web-worker.sh deploy-test-wwz # dummy data that doesn't depend on the build fi @@ -40,12 +40,12 @@ publish-html-assuming-ssh-key() { # Note: the directory structure will be overlapping, unlike Github which has # GITHUB_RUN_NUMBER # - # srht-jobs/ + # sourcehut-jobs/ # 1234/foo.wwz # individual jobs # 1235/bar.wwz # git-0101abab/index.html # commit hash - time soil/web-worker.sh remote-event-job-done 'srht-' "git-$commit_hash" + time soil/web-worker.sh remote-event-job-done 'sourcehut-' "git-$commit_hash" } # diff --git a/soil/web-init.sh b/soil/web-init.sh index 4238d35ba2..15e355c158 100755 --- a/soil/web-init.sh +++ b/soil/web-init.sh @@ -26,7 +26,7 @@ source soil/common.sh # for SOIL_USER and SOIL_HOST home-page() { ### travis-ci.oilshell.org home page - local domain=${1:-'travis-ci.oilshell.org'} + local domain=${1:-$SOIL_HOST} local title="Soil on $domain" soil-html-head "$title" @@ -53,24 +53,31 @@ home-page() { - sr.ht + sr.ht builds.sr.ht - + + .builds + - Github Actions + Github Actions github.com - + + .github/workflows + +EOF + if false; then + echo ' Circle CI @@ -100,40 +107,46 @@ home-page() { + ' + fi + echo '

Links

-EOF +' } deploy-data() { local user=${1:-$SOIL_USER} local host=${2:-$SOIL_HOST} - # www/ prefix for Mythic beasts - local host_dir=$SOIL_REMOTE_DIR + local host_dir=$SOIL_REMOTE_DIR/uuu # TODO: Better to put HTML in www/$host/uuu/github-jobs, etc. ssh $user@$host mkdir -v -p \ - $host_dir/{travis-jobs,srht-jobs,github-jobs,circle-jobs,cirrus-jobs,web,status-api/github} \ + $host_dir/{sourcehut-jobs,github-jobs,status-api/github} \ $host_dir/web/table - home-page "$host" > _tmp/index.html - # note: duplicating CSS - scp _tmp/index.html $user@$host:$host_dir/ scp web/{base.css,soil.css,ajax.js} $user@$host:$host_dir/web scp web/table/*.{js,css} $user@$host:$host_dir/web/table + + home-page "$host" > _tmp/index.html + # Home page goes in the domain root + scp _tmp/index.html $user@$host:$SOIL_REMOTE_DIR/ } soil-web-manifest() { diff --git a/soil/web-worker.sh b/soil/web-worker.sh index d87ce265fa..1768a750c7 100755 --- a/soil/web-worker.sh +++ b/soil/web-worker.sh @@ -35,7 +35,7 @@ source web/table/html.sh # table-sort-{begin,end} # 3619/ # $GITHUB_RUN_NUMBER # dev-minimal.wwz # cpp-small.wwz -# srht-jobs/ +# sourcehut-jobs/ # index.html # 22/ # $JOB_ID # dev-minimal.wwz @@ -48,7 +48,7 @@ sshq() { # # This is Bernstein chaining through ssh. - ssh $SOIL_USER@$SOIL_HOST "$(printf '%q ' "$@")" + my-ssh $SOIL_USER_HOST "$(printf '%q ' "$@")" } remote-rewrite-jobs-index() { @@ -63,8 +63,18 @@ remote-cleanup-jobs-index() { remote-cleanup-status-api() { #sshq soil-web/soil/web.sh cleanup-status-api false - # 2024-07 - work around bug. The logic in soil/web.sh doesn't seem right - sshq soil-web/soil/web.sh cleanup-status-api true + # 2024-07 - work around bug by doing dry_run only. + # + # TODO: Fix the logic in soil/web.sh + + if false; then + sshq soil-web/soil/web.sh cleanup-status-api true + else + curl --include \ + --form 'run-hook=soil-cleanup-status-api' \ + --form 'arg1=true' \ + $WWUP_URL + fi } my-scp() { @@ -85,16 +95,26 @@ scp-status-api() { # We could make this one invocation of something like: # cat $status_file | sshq soil/web.sh PUT $remote_path - my-ssh $SOIL_USER_HOST "mkdir -p $(dirname $remote_path)" - - # the consumer should check if these are all zero - # note: the file gets RENAMED - my-scp $status_file "$SOIL_USER_HOST:$remote_path" + if false; then + my-ssh $SOIL_USER_HOST "mkdir -p $(dirname $remote_path)" + + # the consumer should check if these are all zero + # note: the file gets RENAMED + my-scp $status_file "$SOIL_USER_HOST:$remote_path" + else + # Note: we don't need to change the name of the file, because we just glob + # the dir + curl --include \ + --form 'payload-type=status-api' \ + --form "subdir=github/$run_id" \ + --form "file1=@$status_file" \ + $WWUP_URL + fi } scp-results() { # could also use Travis known_hosts addon? - local prefix=$1 # srht- or '' + local prefix=$1 # sourcehut- or '' shift my-scp "$@" "$SOIL_USER_HOST:$SOIL_REMOTE_DIR/${prefix}jobs/" @@ -252,9 +272,9 @@ test-collect-json() { deploy-job-results() { ### Copy .wwz, .tsv, and .json to a new dir - local prefix=$1 # e.g. example.com/github-jobs/ - local subdir=$2 # e.g. example.com/github-jobs/1234/ # make this dir - local job_name=$3 # e.g. example.com/github-jobs/1234/foo.wwz + 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 @@ -273,17 +293,28 @@ deploy-job-results() { # So we don't have to unzip it cp _tmp/soil/INDEX.tsv $job_name.tsv - local remote_dest_dir="$SOIL_REMOTE_DIR/${prefix}jobs/$subdir" - my-ssh $SOIL_USER_HOST "mkdir -p $remote_dest_dir" - - # Do JSON last because that's what 'list-json' looks for - my-scp $job_name.{wwz,tsv,json} "$SOIL_USER_HOST:$remote_dest_dir" + if false; then + local remote_dest_dir="$SOIL_REMOTE_DIR/${prefix}jobs/$run_dir" + my-ssh $SOIL_USER_HOST "mkdir -p $remote_dest_dir" + + # Do JSON last because that's what 'list-json' looks for + my-scp $job_name.{wwz,tsv,json} "$SOIL_USER_HOST:$remote_dest_dir" + else + curl \ + --include \ + --form "payload-type=${prefix}jobs" \ + --form "subdir=$run_dir" \ + --form "file1=@${job_name}.wwz" \ + --form "file2=@${job_name}.tsv" \ + --form "file3=@${job_name}.json" \ + $WWUP_URL + fi log '' log 'View CI results here:' log '' - log "http://$SOIL_HOST/${prefix}jobs/$subdir/" - log "http://$SOIL_HOST/${prefix}jobs/$subdir/$job_name.wwz/" + log "https://$SOIL_HOST/${prefix}jobs/$run_dir/" + log "https://$SOIL_HOST/${prefix}jobs/$run_dir/$job_name.wwz/" log '' } @@ -292,7 +323,7 @@ publish-cpp-tarball() { # Example of dir structure we need to cleanup: # - # srht-jobs/ + # sourcehut-jobs/ # git-$hash/ # index.html # oils-for-unix.tar @@ -305,46 +336,79 @@ publish-cpp-tarball() { # 2. Get the OLDEST commit dates, e.g. all except for 50 # 3. Delete all commit hash dirs not associated with them - # Fix subtle problem here !!! - shopt -s inherit_errexit + if false; then + # Note: don't upload code without auth + # TODO: Move it to a different dir. - local git_commit_dir - git_commit_dir=$(git-commit-dir "$prefix") + local commit_hash + commit_hash=$(cat _tmp/soil/commit-hash.txt) - my-ssh $SOIL_USER_HOST "mkdir -p $git_commit_dir" + local tar=_release/oils-for-unix.tar + curl --include \ + --form 'payload-type=github-jobs' \ + --form "subdir=git-$commit_hash" \ + --form "file1=@$tar" \ + $WWUP_URL - # Do JSON last because that's what 'list-json' looks for + log 'Tarball:' + log '' + log "http://$SOIL_HOST/code/github-jobs/git-$commit_hash/" - local tar=_release/oils-for-unix.tar + else + # Fix subtle problem here !!! + shopt -s inherit_errexit - # Permission denied because of host/guest issue - #local tar_gz=$tar.gz - #gzip -c $tar > $tar_gz + local git_commit_dir + git_commit_dir=$(git-commit-dir "$prefix") - # Avoid race condition - # Crappy UUID: seconds since epoch, plus PID - local timestamp - timestamp=$(date +%s) + my-ssh $SOIL_USER_HOST "mkdir -p $git_commit_dir" - local temp_name="tmp-$timestamp-$$.tar" + # Do JSON last because that's what 'list-json' looks for - my-scp $tar "$SOIL_USER_HOST:$git_commit_dir/$temp_name" + local tar=_release/oils-for-unix.tar - my-ssh $SOIL_USER_HOST \ - "mv -v $git_commit_dir/$temp_name $git_commit_dir/oils-for-unix.tar" + # Permission denied because of host/guest issue + #local tar_gz=$tar.gz + #gzip -c $tar > $tar_gz + + # Avoid race condition + # Crappy UUID: seconds since epoch, plus PID + local timestamp + timestamp=$(date +%s) + + local temp_name="tmp-$timestamp-$$.tar" + + my-scp $tar "$SOIL_USER_HOST:$git_commit_dir/$temp_name" + + my-ssh $SOIL_USER_HOST \ + "mv -v $git_commit_dir/$temp_name $git_commit_dir/oils-for-unix.tar" + + log 'Tarball:' + log '' + log "http://$git_commit_dir" + fi - log 'Tarball:' - log '' - log "http://$git_commit_dir" } remote-event-job-done() { ### "Client side" handler: a job calls this when it's done - log "remote-event-job-done" + local prefix=$1 # 'github-' or 'sourcehut-' + local run_id=$2 # $GITHUB_RUN_NUMBER or git-$hash + + log "remote-event-job-done $prefix $run_id" # Deployed code dir - sshq soil-web/soil/web.sh event-job-done "$@" + if false; then + sshq soil-web/soil/web.sh event-job-done "$@" + else + # Note: I think curl does URL escaping of arg1= arg2= ? + curl --include \ + --form 'run-hook=soil-event-job-done' \ + --form "arg1=$prefix" \ + --form "arg2=$run_id" \ + $WWUP_URL + fi } filename=$(basename $0) diff --git a/soil/web.py b/soil/web.py index b07ef676c8..e618be8e8c 100755 --- a/soil/web.py +++ b/soil/web.py @@ -31,7 +31,7 @@ $ soil/web-init.sh deploy-code $ soil/web-worker.sh remote-rewrite-jobs-index github- ${GITHUB_RUN_NUMBER} - $ soil/web-worker.sh remote-rewrite-jobs-index srht- git-${commit_hash} + $ soil/web-worker.sh remote-rewrite-jobs-index sourcehut- git-${commit_hash} """ from __future__ import print_function @@ -347,7 +347,7 @@ def ParseJobs(stdin): meta['sourcehut-commit-link'] = commit_link # sourcehut doesn't have RUN ID, so we're in - # srht-jobs/git-ab01cd/index.html, and need to find srht-jobs/123/foo.wwz + # sourcehut-jobs/git-ab01cd/index.html, and need to find sourcehut-jobs/123/foo.wwz run_url_prefix = '../%s/' % sourcehut_job_id # For Github, we construct $JOB_URL in soil/github-actions.sh @@ -670,7 +670,7 @@ def ByGithubRun(row): def main(argv): action = argv[1] - if action == 'srht-index': + if action == 'sourcehut-index': index_out = argv[2] run_index_out = argv[3] run_id = argv[4] # looks like git-0101abab @@ -743,7 +743,7 @@ def main(argv): # git-$hash/ # oils-for-unix.tar # - # srht-jobs/ + # sourcehut-jobs/ # 1234/ # cpp-tarball.{json,wwz,tsv} # 1235/ diff --git a/soil/web.sh b/soil/web.sh index 8f00f0d937..6bb4e05f78 100755 --- a/soil/web.sh +++ b/soil/web.sh @@ -21,7 +21,15 @@ source $REPO_ROOT/soil/common.sh readonly NUM_JOBS=4000 soil-web() { - PYTHONPATH=$REPO_ROOT $REPO_ROOT/soil/web.py "$@" + # We may be executed by a wwup.cgi on the server, which doesn't have + # PATH=~/bin, and the shebang is /usr/bin/env python2 + + local -a prefix=() + if test -n "${CONTENT_LENGTH:-}"; then + prefix=( ~/bin/python2 ) + fi + + PYTHONPATH=$REPO_ROOT "${prefix[@]}" $REPO_ROOT/soil/web.py "$@" } # Bug fix for another race: @@ -40,9 +48,9 @@ rewrite-jobs-index() { local prefix=$1 local run_id=$2 # pass GITHUB_RUN_NUMBER or git-$hash - local dir=$SOIL_HOST_DIR/${prefix}jobs + local dir=$SOIL_HOST_DIR/uuu/${prefix}jobs - log "soil-web: Rewriting ${prefix}jobs/index.html" + log "soil-web: Rewriting uuu/${prefix}jobs/index.html" # Fix for bug #1169: don't create the temp file on a different file system, # which /tmp may be. @@ -74,7 +82,7 @@ cleanup-jobs-index() { local prefix=$1 local dry_run=${2:-true} - local dir=$SOIL_HOST_DIR/${prefix}jobs + local dir=$SOIL_HOST_DIR/uuu/${prefix}jobs # Pass it all JSON, and then it figures out what files to delete (TSV, etc.) case $dry_run in @@ -112,7 +120,7 @@ cleanup-status-api() { local dry_run=${1:-true} - local dir=$SOIL_HOST_DIR/status-api/github + local dir=$SOIL_HOST_DIR/uuu/status-api/github pushd $dir case $dry_run in @@ -132,7 +140,7 @@ cleanup-status-api() { event-job-done() { ### "Server side" handler - local prefix=$1 # 'github-' or 'srht-' + local prefix=$1 # 'github-' or 'sourcehut-' local run_id=$2 # $GITHUB_RUN_NUMBER or git-$hash rewrite-jobs-index $prefix $run_id @@ -141,6 +149,26 @@ event-job-done() { cleanup-jobs-index $prefix false } +DISABLED-event-job-done() { + ### Hook for wwup.cgi to execute + + # As long as the CGI script shows output, I don't think we need any wrappers + # The scripts are written so we don't need to 'cd' + _event-job-done "$@" + return + + # This is the directory that soil/web-init.sh deploys to, and it's shaped + # like the Oils repo + cd ~/soil-web + + # Figure out why exit code is 127 + # Oh probably because it's not started in the home dir? + + # TODO: I guess wwup.cgi can buffer this entire response or something? + # You POST and you get of status, stdout, stderr back? + _event-job-done "$@" > ~/event-job-done.$$.log 2>&1 +} + # # Dev Tools # @@ -180,6 +208,15 @@ local-test() { hello() { echo "hi from $0" echo + + echo ARGS + local i=0 + for arg in "$@"; do + echo "[$i] $arg" + i=$(( i + 1 )) + done + echo + whoami hostname }