feat: allow job-run on non-service and stopped containers#413
Open
nekrich wants to merge 1 commit intomcuadros:masterfrom
Open
feat: allow job-run on non-service and stopped containers#413nekrich wants to merge 1 commit intomcuadros:masterfrom
nekrich wants to merge 1 commit intomcuadros:masterfrom
Conversation
nekrich
pushed a commit
to nekrich/ofelia
that referenced
this pull request
Feb 13, 2026
## Summary - Add new linters: testifylint, usestdlibvars, fatcontext, intrange, dupword, err113 - Create static error definitions for err113 compliance (cli/errors.go, middlewares/errors.go, core/errors.go) - Fix all surfacing linter issues (100+ issues → 0) - Add comprehensive test file exclusions for practical linting ## Changes ### New Linters Added | Linter | Purpose | |--------|---------| | testifylint | Enforce testify best practices | | usestdlibvars | Use stdlib constants (http.MethodGet, etc.) | | fatcontext | Detect context.Context in structs | | intrange | Go 1.22+ integer range syntax | | dupword | Detect duplicate words in comments | | err113 | Require static error definitions | ### Static Error Definitions - `cli/errors.go` - Validation errors for CLI - `middlewares/errors.go` - Preset, webhook, and security errors - Extended `core/errors.go` with scheduler, shutdown, resilience errors ### Test File Exclusions Relaxed linting for test files (practical trade-off): - errcheck, dupl, errorlint, gocritic, predeclared, staticcheck, unparam ### Configuration - goconst min-occurrences: 5 (avoids struct tag false positives) - paralleltest/tparallel exclusions for integration/mutation tests ## Test plan - [x] `golangci-lint run` → 0 issues - [x] `go test ./...` → All passing - [x] `go test ./... -tags=integration,e2e` → All passing ## Metrics | Metric | Value | |--------|-------| | Files changed | 66 | | Linter (uncached) | 11.5s | | Unit tests | 2.3s | | All tests (integration+e2e) | 25s |
nekrich
pushed a commit
to nekrich/ofelia
that referenced
this pull request
Feb 13, 2026
## Summary Updates CHANGELOG.md with release notes for v0.17.0 including: - **Secure Web Authentication** (mcuadros#408) - **Doctor Command Enhancements** (mcuadros#408) - **ntfy-token Preset** (mcuadros#409) - **Webhook Host Whitelist** (mcuadros#410) - **CronClock Interface** (mcuadros#412) - **Cookie Security Hardening** (mcuadros#411) - **GitHub Actions Pinning** (mcuadros#411) - **Test Infrastructure Improvements** (mcuadros#412) - **Performance Optimizations** (mcuadros#412) - **Linting Audit** (mcuadros#413) ## Test Plan - [x] Changelog follows Keep a Changelog format - [x] All PR references are correct - [x] Date is correct (2025-12-22)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #412 😅
Summary
This PR allows
job-runto be defined on non-service and stopped containers. Ofelia now parses labels from all matching containers (including stopped ones) and accepts run jobs from any container labels.localandservice-runjobs remain restricted to the ofelia service container.Changes
Label source includes stopped containers
GetDockerLabels()now callsListContainers(..., All: true), so stopped containers are listed, and their labels are read. This enables one-off run jobs that target stopped containers.New
DockerContainerInfotypeLabels are keyed by container name and running state:
map[DockerContainerInfo]map[string]stringinstead ofmap[string]map[string]string. This allows treating running vs. stopped containers differently.Job type rules
job-runis allowed. Exec, local, and service-run labels on stopped containers are ignored.job-localandjob-service-runare still only allowed on the ofelia service container; labels on other containers log a warning and are ignored.Improvement:
dockerLabelsUpdatenow setsparsedLabelConfig.logger = c.loggerbefore callingbuildFromDockerLabels, avoiding a nil pointer dereference, and there is a warning if some parameters are incorrect.Tests
DockerContainerInfoand to set a test logger sobuildFromDockerLabelsandDeepEqualsstill behave correctly.containerlabel, and "only run jobs allowed on stopped containers."