Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit cbf7c08

Browse files
authored
Merge pull request #1 from ldornele/HYPERFLEET-268
Implement MVP pull secret job with Dockerfile, Makefile, and job execution framework
2 parents 288cf3d + 82e59fb commit cbf7c08

File tree

12 files changed

+2148
-1
lines changed

12 files changed

+2148
-1
lines changed

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.23.9'
26+
cache: true
27+
28+
- name: Run golangci-lint
29+
uses: golangci/golangci-lint-action@v6
30+
with:
31+
version: latest
32+
args: --timeout=5m
33+
34+
build:
35+
name: Build
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
41+
- name: Set up Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: '1.23.9'
45+
cache: true
46+
47+
- name: Download dependencies
48+
run: go mod download
49+
50+
- name: Build binary
51+
run: make binary
52+
53+
- name: Verify binary
54+
run: |
55+
./pull-secret --help
56+
ls -lh pull-secret
57+
58+
test:
59+
name: Test
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v4
64+
65+
- name: Set up Go
66+
uses: actions/setup-go@v5
67+
with:
68+
go-version: '1.23.9'
69+
cache: true
70+
71+
- name: Download dependencies
72+
run: go mod download
73+
74+
- name: Run tests
75+
run: make test
76+
77+
- name: Upload coverage
78+
uses: codecov/codecov-action@v4
79+
if: success()
80+
with:
81+
files: ./coverage.txt
82+
flags: unittests
83+
fail_ci_if_error: false

.gitignore

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Binaries for programs and plugins
2+
pull-secret
3+
pull-secret-mvp
4+
*.exe
5+
*.exe~
6+
*.dll
7+
*.so
8+
*.dylib
9+
10+
# Test binary, built with `go test -c`
11+
*.test
12+
13+
# Output of the go coverage tool
14+
*.out
15+
coverage.txt
16+
coverage.html
17+
18+
# Go workspace file
19+
go.work
20+
21+
# Dependency directories
22+
vendor/
23+
24+
# Go build cache
25+
.cache/
26+
27+
# IDE - VSCode
28+
.vscode/
29+
*.code-workspace
30+
31+
# IDE - IntelliJ / GoLand
32+
.idea/
33+
*.iml
34+
*.iws
35+
*.ipr
36+
37+
# IDE - Vim
38+
*.swp
39+
*.swo
40+
*~
41+
.*.sw?
42+
43+
# IDE - Emacs
44+
*~
45+
\#*\#
46+
.\#*
47+
48+
# OS - macOS
49+
.DS_Store
50+
.AppleDouble
51+
.LSOverride
52+
._*
53+
54+
# OS - Windows
55+
Thumbs.db
56+
Thumbs.db:encryptable
57+
ehthumbs.db
58+
ehthumbs_vista.db
59+
Desktop.ini
60+
61+
# OS - Linux
62+
.directory
63+
.Trash-*
64+
65+
# Temporary files
66+
tmp/
67+
temp/
68+
*.tmp
69+
*.bak
70+
*.log
71+
72+
# Environment variables and secrets
73+
.env
74+
.env.*
75+
!.env.example
76+
*.key
77+
*.pem
78+
*.crt
79+
*.csr
80+
secrets/
81+
*.secret
82+
83+
# GCP credentials (NEVER commit these!)
84+
*-credentials.json
85+
*-serviceaccount.json
86+
service-account-*.json
87+
gcp-*.json
88+
application_default_credentials.json
89+
90+
# Database files
91+
*.db
92+
*.sqlite
93+
*.sqlite3
94+
95+
# Container/Docker local artifacts
96+
*.tar
97+
*.tar.gz
98+
99+
# Build artifacts and binaries
100+
dist/
101+
build/
102+
bin/
103+
104+
# Test cache
105+
testdata/output/
106+
107+
# Air (live reload) temp files
108+
tmp/
109+
110+
# Delve debugger
111+
__debug_bin
112+
113+
# Go sum backup
114+
go.sum.backup
115+
116+
# Templates rendered (if any)
117+
templates/*-template.json
118+
119+
# Local test files
120+
*_local_test.go
121+
122+
# Performance profiles
123+
*.prof
124+
*.pprof
125+
126+
# Migration files (if dynamically generated)
127+
migrations/*.sql.tmp
128+
129+
# Claude settings (local only)
130+
.claude/

.golangci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# golangci-lint configuration for HyperFleet Pull Secret Job
2+
# https://golangci-lint.run/usage/configuration/
3+
4+
run:
5+
timeout: 5m
6+
tests: true
7+
modules-download-mode: readonly
8+
9+
linters:
10+
enable:
11+
- gofmt # Checks whether code was gofmt-ed
12+
- goimports # Checks import statements are formatted according to the 'goimport' command
13+
- govet # Reports suspicious constructs
14+
- errcheck # Checks for unchecked errors
15+
- staticcheck # Static analysis checks
16+
- unused # Checks for unused constants, variables, functions and types
17+
- gosimple # Simplify code
18+
- ineffassign # Detects ineffectual assignments
19+
- typecheck # Type-checks Go code
20+
- misspell # Finds commonly misspelled English words
21+
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go
22+
- gocritic # Provides diagnostics that check for bugs, performance and style issues
23+
24+
linters-settings:
25+
gofmt:
26+
simplify: true
27+
28+
govet:
29+
enable:
30+
- shadow
31+
disable:
32+
- check-shadowing
33+
34+
errcheck:
35+
check-type-assertions: true
36+
check-blank: true
37+
38+
revive:
39+
rules:
40+
- name: exported
41+
severity: warning
42+
disabled: true # Disabled for MVP - can enable later
43+
- name: unexported-return
44+
severity: warning
45+
disabled: false
46+
- name: var-naming
47+
severity: warning
48+
disabled: false
49+
50+
issues:
51+
exclude-use-default: false
52+
max-issues-per-linter: 0
53+
max-same-issues: 0
54+
55+
# Exclude some linters from running on tests files
56+
exclude-rules:
57+
- path: _test\.go
58+
linters:
59+
- errcheck
60+
- gosec
61+
# Exclude pkg/job and pkg/config (external framework code)
62+
- path: pkg/
63+
linters:
64+
- revive
65+
- goimports
66+
67+
output:
68+
formats:
69+
- format: colored-line-number
70+
print-issued-lines: true
71+
print-linter-name: true

Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Multi-stage build for pull-secret-mvp
2+
# Stage 1: Builder
3+
FROM registry.access.redhat.com/ubi9/go-toolset:1.23 AS builder
4+
5+
# Switch to root to set up workspace
6+
USER root
7+
8+
# Set working directory
9+
WORKDIR /workspace
10+
11+
# Copy go mod files
12+
COPY --chown=default:root go.mod go.sum ./
13+
14+
# Download dependencies
15+
RUN go mod download
16+
17+
# Copy source code
18+
COPY --chown=default:root . .
19+
20+
# Switch back to default user
21+
USER default
22+
23+
# Build the binary
24+
# CGO_ENABLED=0 for static binary (simplified MVP build)
25+
RUN CGO_ENABLED=0 go build \
26+
-o pull-secret \
27+
./cmd/pull-secret
28+
29+
# Stage 2: Runtime
30+
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
31+
32+
# Install CA certificates for TLS
33+
RUN microdnf install -y ca-certificates && microdnf clean all
34+
35+
# Create non-root user
36+
RUN useradd -u 1000 -m -s /sbin/nologin pullsecret-job
37+
38+
# Set working directory
39+
WORKDIR /app
40+
41+
# Copy binary from builder
42+
COPY --from=builder --chown=1000:1000 /workspace/pull-secret /usr/local/bin/pull-secret
43+
44+
# Set permissions
45+
RUN chmod 755 /usr/local/bin/pull-secret
46+
47+
# Use non-root user
48+
USER 1000
49+
50+
# Set entrypoint
51+
ENTRYPOINT ["/usr/local/bin/pull-secret"]
52+
53+
# Default command (can be overridden)
54+
CMD ["run-job", "pull-secret"]

0 commit comments

Comments
 (0)