~shulhan/karajo

go.mod: update all dependencies
make: fix file permissions when installing public index.html

Using 0640 (where user and group owner set to root) cause karajo
service--that run as karajo user--unable to read the file.
Release karajo v0.9.1 (2024-04-06)

This release mostly contains chores.

* env: remove [rand.Seed] usage

  The [ascii.Random] generate random using "crypto/rand", so no need to
  seed it anymore.

* all: replace module "share" with "pakakeh.go"

  The "share" module repository has been moved to SourceHut, with new
  name "pakakeh.go".
go.mod: update ciigo and pakakeh.go to latest release
all: replace module "share" with "pakakeh.go"
httpd: update comment on HTTP API to get JobExec log

Simplify the comment without heading "#", following the other comment
format.
job_http: remove unused method setStatus
env: remove [rand.Seed] usage

The [ascii.Random] generate random using "crypto/rand", so no need to
seed it anymore.
Release karajo v0.9.0 (2024-02-08)

=== Breaking changes

* all: refactoring JobExec APIs to have "_exec" suffix

  In JobHttp, we have "_http" suffix for its HTTP APIs.
  To make it consistent we changes the HTTP API path to have "_exec" suffix.

* all: apply default revive suggestions

  I prefer zero configuration rather that creating exclusions,
  like "revive.toml" file that we have earlier, even thought it will cause
  breaking changes to our APIs.

  Some breaking changes, [Env.HttpJobs] become [Env.HTTPJobs]
  [Env.HttpTimeout] become [Env.HTTPTimeout],
  [Env.HttpJobs] become [Env.HTTPJobs], and many more.

=== New features

* all: implement API to cancel running job

  In the JobBase we add method Cancel to cancel running JobExec or JobHTTP.
  In the HTTP server, we add endpoint "POST /karajo/api/job_exec/cancel"
  to cancel JobExec by its ID.

  Implements: https://todo.sr.ht/~shulhan/karajo/1

=== Enhancements

* all: export the HTTP server field in Karajo

  By exporting the HTTP server field, user of Karajo can register
  additional HTTP endpoints without creating new HTTP server instance.

=== Bug fixes

* all: always call finish even if the job is paused

  This is to make the [JobBase.NextRun] always set to next interval or
  schedule.

  Fixes: https://todo.sr.ht/~shulhan/karajo/2

* _sys: set systemd unit to start after network.target

  This is to fix karajo failed to start because the DNS has not working
  yet when initializing email notification.
go.mod: update all dependencies
all: implement API to cancel running job

In the JobBase we add method Cancel to cancel running JobExec or JobHTTP.

In the HTTP server, we add endpoint "POST /karajo/api/job_exec/cancel"
to cancel JobExec by its ID.

Implements: https://todo.sr.ht/~shulhan/karajo/1
test: fix race during testing due to concurrent read/write on logq

When Karajo Start-ed, its start each JobExec/JobHTTP as go-routine by
passing the logq.
If one of the job Start (read logq) and other test call [JobBase.finish]
(write to logq) at the same time this cause data race.

To fix this we wait for job Start to finish reading logq by communicate
using jobq.
env: rename internal method job to jobExec to minimize ambiguity
test: simplify testing JobExec Call

Instead of running test with [JobExec.Start], call the run method
directly, so we did not need to wait for Interval to be triggered.
test: fix flaky test on apiJobExecLog

Using "$RANDOM" when executing a command result in inconsistent JobLog
content.
While at it, we wait for the job to be completed with status success
before we check the job result.
all: unexport all errors and make it non-pointer
all: refactoring JobExec APIs to have "_exec" suffix

In JobHttp, we have "_http" suffix for its HTTP APIs.
test: use [libnet.WaitAlive] to wait for server ready before running tests
all: un export and simplify timeNow function

The timenow return time in UTC rounded to second.
job_exec: pass the HTTP request to execute method
Next