Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .containifyci/containifyci.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ func main() {
func DockerFile() *protos2.ContainerFile {
return &protos2.ContainerFile{
Name: "golang-1.26.2-alpine-custom",
Content: `FROM golang:1.26.1-alpine
Content: `FROM --platform=$BUILDPLATFORM golang:1.26.1-alpine

RUN apk --no-cache add git openssh-client && \
rm -rf /var/cache/apk/*

RUN go install github.com/wadey/gocovmerge@latest && \
go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest && \
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.8.0 && \
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 && \
go clean -cache && \
go clean -modcache
WORKDIR /app`,
Expand Down
14 changes: 14 additions & 0 deletions .franky-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
stages:
- name: build
command: "go build main.go"
timeout_ms: 120000

- name: lint
command: "/home/agent/go/bin/golangci-lint run --fix"
timeout_ms: 120000
needs: [build]

- name: test
command: "go test ./..."
timeout_ms: 120000
needs: [build]
2 changes: 1 addition & 1 deletion .github/workflows/engine-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
${{ runner.os }}-cache-

- name: Install Engine CI
uses: jaxxstorm/action-install-gh-release@v1
uses: jaxxstorm/action-install-gh-release@v3.0.0
if: ${{ inputs.install_binary }}
with:
repo: containifyci/engine-ci
Expand Down
41 changes: 23 additions & 18 deletions cmd/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,33 @@ func SaveCache() error {
os.Exit(1)
}
cmd := fmt.Sprintf(`
set -x
docker pull %s
docker save -o ~/image-cache/%s.tar %s
`, image, info.Image, image)
set -x
docker pull %s
docker save -o ~/image-cache/%s.tar %s
`, image, info.Image, image)
go runCommand(&wg, errs, "sh", []string{"-c", cmd}...)
}

// Wait for all commands to complete
wg.Wait()
close(errs)
// Check for any errors
for err := range errs {
// errors.
slog.Warn("Error pull image", "error", err)
if err != nil {
slog.Warn("Error pull image", "error", err)
}
}
return nil
}

func LoadCache() error {
InitBuildSteps()
args := GetBuild(false) // Use plugin system for cache operations
//TODO: possible nil pointer dereference
if len(args) == 0 {
return fmt.Errorf("no build groups found in cache load")
}
if len(args[0].Builds) == 0 {
return fmt.Errorf("no builds found in first build group for cache load")
}
arg := args[0].Builds[0]
images := buildSteps.Images(args)
if len(images) == 0 {
Expand All @@ -121,15 +126,15 @@ func LoadCache() error {
// nolint:staticcheck
if arg.Runtime == utils.Docker {
cmd := fmt.Sprintf(`
set -x
docker load -i ~/image-cache/%s.tar
`, info.Image)
set -x
docker load -i ~/image-cache/%s.tar
`, info.Image)
go runCommand(&wg, errs, "sh", []string{"-c", cmd}...)
} else if arg.Runtime == utils.Podman {
cmd := fmt.Sprintf(`
set -x
podman load -i ~/image-cache/%s.tar
`, info.Image)
set -x
podman load -i ~/image-cache/%s.tar
`, info.Image)
runCommand(&wg, errs, "sh", []string{"-c", cmd}...)
} else {
slog.Warn("Unsupported runtime for cache load", "runtime", arg.Runtime)
Expand All @@ -140,10 +145,10 @@ podman load -i ~/image-cache/%s.tar
// Wait for all commands to complete
wg.Wait()
close(errs)
// Check for any errors
for err := range errs {
// errors.
slog.Warn("Error loading image", "error", err)
if err != nil {
slog.Warn("Error loading image", "error", err)
}
}
return nil
}
Expand All @@ -160,6 +165,6 @@ func runCommand(wg *sync.WaitGroup, errors chan<- error, cmd string, args ...str
// Run the command
err := command.Run()
if err != nil {
errors <- fmt.Errorf("error running command: error %s, cmd %s, args %s", err, cmd, args)
errors <- fmt.Errorf("run command %s %v: %w", cmd, args, err)
}
}
Loading
Loading