Compare commits
13 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d97839cd90 | |||
| 1f8217d99b | |||
| cd83c525c8 | |||
| 88e6654a6c | |||
|
|
10a9ab9001 | ||
|
|
ea961a70c3 | ||
|
|
8a98a8a512 | ||
|
|
2301db6f85 | ||
|
|
aab9e22819 | ||
|
|
403489591e | ||
|
|
8034eaaabb | ||
|
|
44f4557005 | ||
|
|
d92a892ece |
16 changed files with 145 additions and 22 deletions
27
.forgejo/workflows/build-ipcei.yml
Normal file
27
.forgejo/workflows/build-ipcei.yml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
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
|
||||||
|
|
@ -19,7 +19,7 @@ on:
|
||||||
enable-email-notifications: true
|
enable-email-notifications: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
FORGEJO_VERSION: 11.0.6 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
|
FORGEJO_VERSION: 11.0.7 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-simulation:
|
release-simulation:
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ on:
|
||||||
enable-email-notifications: true
|
enable-email-notifications: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
FORGEJO_VERSION: 11.0.6 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
|
FORGEJO_VERSION: 11.0.7 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
|
||||||
FORGEJO_USER: root
|
FORGEJO_USER: root
|
||||||
FORGEJO_PASSWORD: admin1234
|
FORGEJO_PASSWORD: admin1234
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.6 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
|
USE_VERSION: 11.0.7 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
example-lxc-systemd:
|
example-lxc-systemd:
|
||||||
|
|
|
||||||
60
.goreleaser.yaml
Normal file
60
.goreleaser.yaml
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
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
|
||||||
|
|
@ -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.24-alpine3.22 AS build-env
|
FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/golang:1.25-alpine3.22 AS build-env
|
||||||
|
|
||||||
#
|
#
|
||||||
# Transparently cross compile for the target platform
|
# Transparently cross compile for the target platform
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
|
|
@ -25,7 +24,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 := syscall.Kill(syscall.Getpid(), syscall.SIGTERM); err != nil {
|
if err := suicide(); 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
act/artifactcache/utils.go
Normal file
9
act/artifactcache/utils.go
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package artifactcache
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func suicide() error {
|
||||||
|
return syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
|
||||||
|
}
|
||||||
14
act/artifactcache/utils_windows.go
Normal file
14
act/artifactcache/utils_windows.go
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
//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))
|
||||||
|
}
|
||||||
|
|
@ -74,8 +74,6 @@ 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() {
|
||||||
|
|
@ -387,11 +385,14 @@ 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_begin $name)
|
local draft=$(lxc_transaction_draft_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
|
||||||
|
|
@ -406,15 +407,17 @@ 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
|
||||||
|
|
||||||
local draft=$(lxc_transaction_begin $newname)
|
lxc_transaction_begin $name
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,8 @@ 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}}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM alpine:3
|
FROM code.forgejo.org/oci/alpine:latest
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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/node:22-bookworm
|
image: code.forgejo.org/oci/${{ env.IMAGE }}
|
||||||
uses: ./.forgejo/workflows/${{ vars.PATHNAME }}
|
uses: ./.forgejo/workflows/${{ vars.PATHNAME }}
|
||||||
with:
|
with:
|
||||||
STAGE: dev
|
STAGE: dev
|
||||||
|
|
|
||||||
|
|
@ -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"],
|
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix", "env"],
|
||||||
"one-of": ["string", "container-mapping"]
|
"one-of": ["string", "container-mapping"]
|
||||||
},
|
},
|
||||||
"container-mapping": {
|
"container-mapping": {
|
||||||
|
|
|
||||||
|
|
@ -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.1 # renovate: datasource=forgejo-tags depName=forgejo/lxc-helpers
|
DEFAULT_LXC_HELPERS_VERSION=1.1.3 # 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}
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,20 @@ 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 {
|
||||||
task, ok := j.fetchTask(ctx)
|
log.Info("Polling for a job...")
|
||||||
if !ok {
|
for {
|
||||||
return fmt.Errorf("could not fetch task")
|
task, ok := j.fetchTask(ctx)
|
||||||
|
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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue