ЛР7 на 4: HTTPS, mTLS, OpenBao AppRole и ротация leaf.
Skeleton contracts / contracts (pull_request) Blocked by required conditions

Smoke/security/grade4/persistence/failover пройдены; REPORT и DEFENSE.
This commit is contained in:
2026-12-02 23:08:27 +03:00
parent 20afc2c790
commit 2f2047909f
182 changed files with 15169 additions and 90 deletions
+53
View File
@@ -0,0 +1,53 @@
package worker
import (
"bytes"
"context"
"encoding/gob"
"errors"
"os"
"os/exec"
"strconv"
)
func ProcessImage(maxPixels, pipelineVersion int) error {
variants, err := imageVariants(os.Stdin, maxPixels, pipelineVersion)
if err != nil {
return err
}
return gob.NewEncoder(os.Stdout).Encode(variants)
}
func runImageProcess(ctx context.Context, source *os.File, maxPixels, pipelineVersion int) ([]imageVariant, error) {
executable, err := os.Executable()
if err != nil {
return nil, err
}
cmd := exec.CommandContext(ctx, executable,
"-process-image", strconv.Itoa(maxPixels),
"-pipeline-version", strconv.Itoa(pipelineVersion),
)
cmd.Stdin = source
data, err := cmd.Output()
if ctx.Err() != nil {
return nil, ctx.Err()
}
if err != nil {
var exitErr *exec.ExitError
if errors.As(err, &exitErr) && exitErr.ExitCode() == 2 {
return nil, ErrInvalidSource
}
return nil, err
}
var variants []imageVariant
if err := gob.NewDecoder(bytes.NewReader(data)).Decode(&variants); err != nil {
return nil, err
}
return variants, nil
}