// c := config.SourceCode().DockerBuild()
c := containers.NewBaseContainer(ctx, dag, "node")
c = c.WithExec([]string{"echo", "Building Jenkins container with version " + version})
c, err = c.Sync(ctx)
if err != nil {
return fmt.Errorf("failed to sync container: %w", err)
}
c = c.WithRegistryAuth(consts.Registry, consts.Username, dag.SetSecret("password", consts.Token))
c = c.WithLabel("org.opencontainers.image.source", fmt.Sprintf("https://github.com/%s/devops-jenkins", consts.Username))
_, err = c.Publish(ctx, fmt.Sprintf("%s:%s", repository, version))
if err != nil {
return fmt.Errorf("failed to publish Jenkins container: %w", err)
}
This works for publishing.
But If I uncomment the DockerBuild() and comment the NewBaseContainer it fails with
Error: failed to publish Jenkins container: secret xxh3:bd8413b0c8b3ad00: not found
failed to publish Jenkins container: secret xxh3:bd8413b0c8b3ad00: not found
exit status 1