Compare commits

..

No commits in common. "main" and "v11.2.0" have entirely different histories.

16 changed files with 22 additions and 145 deletions

View file

@ -1,27 +0,0 @@
name: ci
on:
push:
tags:
- v*
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ">=1.25.1"
- name: Test code
run: make test
- name: Run GoReleaser
uses: https://github.com/goreleaser/goreleaser-action@v6
env:
GITEA_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
with:
args: release --clean

View file

@ -19,7 +19,7 @@ on:
enable-email-notifications: true enable-email-notifications: true
env: env:
FORGEJO_VERSION: 11.0.7 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo FORGEJO_VERSION: 11.0.6 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
jobs: jobs:
release-simulation: release-simulation:

View file

@ -21,7 +21,7 @@ on:
enable-email-notifications: true enable-email-notifications: true
env: env:
FORGEJO_VERSION: 11.0.7 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo FORGEJO_VERSION: 11.0.6 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
FORGEJO_USER: root FORGEJO_USER: root
FORGEJO_PASSWORD: admin1234 FORGEJO_PASSWORD: admin1234

View file

@ -14,7 +14,7 @@ env:
SERIAL: "30" SERIAL: "30"
LIFETIME: "60" LIFETIME: "60"
SYSTEMD_OPTIONS: "--no-pager --full" SYSTEMD_OPTIONS: "--no-pager --full"
USE_VERSION: 11.0.7 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo USE_VERSION: 11.0.6 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
jobs: jobs:
example-lxc-systemd: example-lxc-systemd:

View file

@ -1,60 +0,0 @@
version: 2
before:
hooks:
- go mod download
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
archives:
- formats: [binary]
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
changelog:
abbrev: 10
filters:
exclude:
- "^docs:"
- "^test:"
format: "{{.SHA}}: {{.Message}}"
groups:
- title: Features
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 0
- title: "Bug fixes"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 1
- title: "Chores"
regexp: '^.*?chore(\([[:word:]]+\))??!?:.+$'
order: 2
- title: Others
order: 999
sort: asc
release:
gitea:
owner: DevFW-CICD
name: runner
force_token: gitea
gitea_urls:
api: https://edp.buildth.ing/api/v1
download: https://edp.buildth.ing
# set to true if you use a self-signed certificate
skip_tls_verify: false

View file

@ -1,6 +1,6 @@
FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/xx AS xx FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/xx AS xx
FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/golang:1.25-alpine3.22 AS build-env FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/golang:1.24-alpine3.22 AS build-env
# #
# Transparently cross compile for the target platform # Transparently cross compile for the target platform

View file

@ -9,6 +9,7 @@ import (
"net/http" "net/http"
"strconv" "strconv"
"strings" "strings"
"syscall"
"time" "time"
"github.com/julienschmidt/httprouter" "github.com/julienschmidt/httprouter"
@ -24,7 +25,7 @@ const (
var fatal = func(logger logrus.FieldLogger, err error) { var fatal = func(logger logrus.FieldLogger, err error) {
logger.Errorf("unrecoverable error in the cache: %v", err) logger.Errorf("unrecoverable error in the cache: %v", err)
if err := suicide(); err != nil { if err := syscall.Kill(syscall.Getpid(), syscall.SIGTERM); err != nil {
logger.Errorf("unrecoverable error in the cache: failed to send the TERM signal to shutdown the daemon %v", err) logger.Errorf("unrecoverable error in the cache: failed to send the TERM signal to shutdown the daemon %v", err)
} }
} }

View file

@ -1,9 +0,0 @@
//go:build !windows
package artifactcache
import "syscall"
func suicide() error {
return syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
}

View file

@ -1,14 +0,0 @@
//go:build windows
package artifactcache
import "syscall"
func suicide() error {
handle, err := syscall.GetCurrentProcess()
if err != nil {
return err
}
return syscall.TerminateProcess(handle, uint32(syscall.SIGTERM))
}

View file

@ -74,6 +74,8 @@ function lxc_transaction_begin() {
lxc_transaction_lock lxc_transaction_lock
lxc_container_destroy $draft lxc_container_destroy $draft
echo $draft
} }
function lxc_transaction_commit() { function lxc_transaction_commit() {
@ -385,14 +387,11 @@ function lxc_running() {
function lxc_build_template_release() { function lxc_build_template_release() {
local name="$(lxc_template_release)" local name="$(lxc_template_release)"
lxc_transaction_begin $name
if lxc_exists_and_apt_not_old $name; then if lxc_exists_and_apt_not_old $name; then
lxc_transaction_unlock
return return
fi fi
local draft=$(lxc_transaction_draft_name) local draft=$(lxc_transaction_begin $name)
$LXC_SUDO lxc-create --name $draft --template debian -- --release=$LXC_CONTAINER_RELEASE $LXC_SUDO lxc-create --name $draft --template debian -- --release=$LXC_CONTAINER_RELEASE
echo 'lxc.apparmor.profile = unconfined' | $LXC_SUDO tee -a $(lxc_config $draft) echo 'lxc.apparmor.profile = unconfined' | $LXC_SUDO tee -a $(lxc_config $draft)
lxc_container_install_lxc_helpers $draft lxc_container_install_lxc_helpers $draft
@ -407,17 +406,15 @@ function lxc_build_template() {
local name="$1" local name="$1"
local newname="$2" local newname="$2"
if lxc_exists_and_apt_not_old $newname; then
return
fi
if test "$name" = "$(lxc_template_release)"; then if test "$name" = "$(lxc_template_release)"; then
lxc_build_template_release lxc_build_template_release
fi fi
lxc_transaction_begin $name local draft=$(lxc_transaction_begin $newname)
if lxc_exists_and_apt_not_old $newname; then
lxc_transaction_unlock
return
fi
local draft=$(lxc_transaction_draft_name)
if ! $LXC_SUDO lxc-copy --name=$name --newname=$draft; then if ! $LXC_SUDO lxc-copy --name=$name --newname=$draft; then
echo lxc-copy --name=$name --newname=$draft failed echo lxc-copy --name=$name --newname=$draft failed
return 1 return 1

View file

@ -193,8 +193,6 @@ var lxcHelpers string
var startTemplate = template.Must(template.New("start").Parse(`#!/bin/bash -e var startTemplate = template.Must(template.New("start").Parse(`#!/bin/bash -e
exec 5<>/tmp/forgejo-runner-lxc.lock ; flock --timeout 21600 5
LXC_CONTAINER_CONFIG="{{.Config}}" LXC_CONTAINER_CONFIG="{{.Config}}"
LXC_CONTAINER_RELEASE="{{.Release}}" LXC_CONTAINER_RELEASE="{{.Release}}"

View file

@ -1,4 +1,4 @@
FROM code.forgejo.org/oci/alpine:latest FROM alpine:3
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh

View file

@ -242,7 +242,7 @@ jobs:
name: Build Silo Frontend DEV name: Build Silo Frontend DEV
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: code.forgejo.org/oci/${{ env.IMAGE }} image: code.forgejo.org/oci/node:22-bookworm
uses: ./.forgejo/workflows/${{ vars.PATHNAME }} uses: ./.forgejo/workflows/${{ vars.PATHNAME }}
with: with:
STAGE: dev STAGE: dev

View file

@ -2008,7 +2008,7 @@
}, },
"container": { "container": {
"description": "A container to run any steps in a job that don't already specify a container. If you have steps that use both script and container actions, the container actions will run as sibling containers on the same network with the same volume mounts.\n\nIf you do not set a container, all steps will run directly on the host specified by runs-on unless a step refers to an action configured to run in a container.", "description": "A container to run any steps in a job that don't already specify a container. If you have steps that use both script and container actions, the container actions will run as sibling containers on the same network with the same volume mounts.\n\nIf you do not set a container, all steps will run directly on the host specified by runs-on unless a step refers to an action configured to run in a container.",
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix", "env"], "context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"one-of": ["string", "container-mapping"] "one-of": ["string", "container-mapping"]
}, },
"container-mapping": { "container-mapping": {

View file

@ -20,7 +20,7 @@ trap "rm -fr $TMPDIR" EXIT
: ${INPUTS_TOKEN:=} : ${INPUTS_TOKEN:=}
: ${INPUTS_FORGEJO:=https://code.forgejo.org} : ${INPUTS_FORGEJO:=https://code.forgejo.org}
: ${INPUTS_LIFETIME:=7d} : ${INPUTS_LIFETIME:=7d}
DEFAULT_LXC_HELPERS_VERSION=1.1.3 # renovate: datasource=forgejo-tags depName=forgejo/lxc-helpers DEFAULT_LXC_HELPERS_VERSION=1.1.1 # renovate: datasource=forgejo-tags depName=forgejo/lxc-helpers
: ${INPUTS_LXC_HELPERS_VERSION:=$DEFAULT_LXC_HELPERS_VERSION} : ${INPUTS_LXC_HELPERS_VERSION:=$DEFAULT_LXC_HELPERS_VERSION}
DEFAULT_RUNNER_VERSION=11.1.2 # renovate: datasource=forgejo-releases depName=forgejo/runner DEFAULT_RUNNER_VERSION=11.1.2 # renovate: datasource=forgejo-releases depName=forgejo/runner
: ${INPUTS_RUNNER_VERSION:=$DEFAULT_RUNNER_VERSION} : ${INPUTS_RUNNER_VERSION:=$DEFAULT_RUNNER_VERSION}

View file

@ -36,20 +36,11 @@ func NewJob(cfg *config.Config, client client.Client, runner run.RunnerInterface
} }
func (j *Job) Run(ctx context.Context) error { func (j *Job) Run(ctx context.Context) error {
log.Info("Polling for a job...") task, ok := j.fetchTask(ctx)
for { if !ok {
task, ok := j.fetchTask(ctx) return fmt.Errorf("could not fetch task")
if ok {
return j.runTaskWithRecover(ctx, task)
}
// No task available, continue polling
select {
case <-ctx.Done():
return ctx.Err()
default:
// Continue to next iteration
}
} }
return j.runTaskWithRecover(ctx, task)
} }
func (j *Job) runTaskWithRecover(ctx context.Context, task *runnerv1.Task) error { func (j *Job) runTaskWithRecover(ctx context.Context, task *runnerv1.Task) error {