Add OCI labels to Docker images and --version flag to docker-agent

- Add OCI image labels to both pulse and pulse-docker-agent images:
  - org.opencontainers.image.title
  - org.opencontainers.image.description
  - org.opencontainers.image.version
  - org.opencontainers.image.created
  - org.opencontainers.image.revision (git sha)
  - org.opencontainers.image.source
  - org.opencontainers.image.url
  - org.opencontainers.image.licenses
- Add --version flag to pulse-docker-agent binary
  - Allows users to verify agent version: pulse-docker-agent --version
  - Outputs: pulse-docker-agent version v4.29.0

Addresses Dev Team 3 findings: CRITICAL-4 (OCI labels) and CRITICAL-5 (--version flag)
Related to #671 (automated release workflow)
This commit is contained in:
rcourtman 2025-11-11 11:52:20 +00:00
parent 1a263ce9d0
commit a8dc2e8e9b
2 changed files with 32 additions and 0 deletions

View file

@ -61,6 +61,15 @@ jobs:
rcourtman/pulse:${{ steps.set_version.outputs.tag }}
ghcr.io/${{ github.repository_owner }}/pulse:latest
ghcr.io/${{ github.repository_owner }}/pulse:${{ steps.set_version.outputs.tag }}
labels: |
org.opencontainers.image.title=Pulse
org.opencontainers.image.description=Proxmox monitoring system
org.opencontainers.image.version=${{ steps.set_version.outputs.tag }}
org.opencontainers.image.created=${{ github.event.repository.updated_at }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.licenses=MIT
- name: Build and push Docker agent image
uses: docker/build-push-action@v6
@ -76,6 +85,15 @@ jobs:
rcourtman/pulse-docker-agent:${{ steps.set_version.outputs.tag }}
ghcr.io/${{ github.repository_owner }}/pulse-docker-agent:latest
ghcr.io/${{ github.repository_owner }}/pulse-docker-agent:${{ steps.set_version.outputs.tag }}
labels: |
org.opencontainers.image.title=Pulse Docker Agent
org.opencontainers.image.description=Docker container monitoring agent for Pulse
org.opencontainers.image.version=${{ steps.set_version.outputs.tag }}
org.opencontainers.image.created=${{ github.event.repository.updated_at }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.licenses=MIT
- name: Output Docker image information
run: |

View file

@ -34,6 +34,20 @@ func (l stringFlagList) Values() []string {
}
func main() {
// Handle --version flag early before other config parsing
versionFlag := false
for _, arg := range os.Args[1:] {
if arg == "--version" || arg == "-version" || arg == "version" {
versionFlag = true
break
}
}
if versionFlag {
fmt.Printf("pulse-docker-agent version %s\n", dockeragent.Version)
os.Exit(0)
}
cfg := loadConfig()
logger := zerolog.New(os.Stdout).With().Timestamp().Logger()