Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/enable tags #1073

Merged
merged 148 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
7147bfe
Add initial Exacloud page to documentation
lbeckman314 May 6, 2024
af00d03
Update Exacloud support
lbeckman314 May 7, 2024
fc3d277
Clean up console debug output
lbeckman314 May 7, 2024
9dbef33
Add default Worker engine ('docker')
lbeckman314 May 8, 2024
a3a3445
Update configurable Container Engine commands
lbeckman314 May 9, 2024
8ec817b
Revert changes to docker implementation and add engine interface
lbeckman314 May 10, 2024
afc5825
Update Exacloud/Container Engine implementation
lbeckman314 May 15, 2024
28905c0
Update ContainerEngine interface
lbeckman314 May 16, 2024
703cf44
Rename ContainerEngine to ContainerType
lbeckman314 May 16, 2024
83d6e1c
Add initial Exadocker unit test
lbeckman314 May 17, 2024
39584ad
Update TaskService to pass config to Funnel worker
lbeckman314 May 17, 2024
1d93375
Add small fix in HPC Template config
lbeckman314 May 17, 2024
1c4221d
Update worker config path in HPC Template
lbeckman314 May 17, 2024
53bb0cb
Add debugging from Exacloud testing
lbeckman314 May 20, 2024
a422b82
Update input/output working example (md5sum)
lbeckman314 May 24, 2024
021eeef
Update docker.go to implement ContainerEngine interface
lbeckman314 May 30, 2024
8e2474c
Remove exadocker implementation in favor of docker
lbeckman314 May 30, 2024
f5acbab
Add initial HPC documentation and example
lbeckman314 May 30, 2024
5450366
Update docker and kin-openapi to compatible versions
lbeckman314 May 31, 2024
2269fd1
Update util/openapi2proto/main.go with latest kin-openapi version
lbeckman314 May 31, 2024
8648580
Update github.com/docker/docker to latest version
lbeckman314 May 31, 2024
75647ce
Update Docker client creation in tests
lbeckman314 May 31, 2024
997d3c2
Add `WithAPIVersionNegotiation` to docker client creation
lbeckman314 May 31, 2024
56e74c2
Rename 'Driver' to 'DriverCommand' in ContainerConfig
lbeckman314 May 31, 2024
a9411bb
Fix minor linting errors
lbeckman314 Jun 1, 2024
ee25bd5
Update GitHub Actions workflow (linting)
lbeckman314 Jun 1, 2024
449e144
fix: updated config check in hpc_backend.go
lbeckman314 Jun 1, 2024
f5df70f
Revert tabs/space change in storage/local.go
lbeckman314 Jun 1, 2024
6374d2f
Update output copying in scratch directory
lbeckman314 Jun 18, 2024
f27f302
Update compliance-test.yaml
lbeckman314 Jun 18, 2024
0f36f11
Debug: add tmate step to Nextflow test
lbeckman314 Jun 20, 2024
c0cc2a8
Update Nextflow tests
lbeckman314 Jun 20, 2024
69bddbe
Update file copying behavior for Nextflow tests
lbeckman314 Jun 20, 2024
2af9c4d
Update local file copying behavior to support directory dests
lbeckman314 Jun 20, 2024
0f14338
Update local dest for files with glob patterns
lbeckman314 Jun 20, 2024
85ce5de
Update Base64Encode test to match Github Actions test
lbeckman314 Jun 20, 2024
56ec776
Fix Base64Encoding test value
lbeckman314 Jun 20, 2024
4bbec3f
Revert glob output change based on TesOutput spec
lbeckman314 Jun 21, 2024
ece1266
Debug: Add tmate step to Nextflow tests
lbeckman314 Jun 21, 2024
c81d0a7
Update wildcard file output destination
lbeckman314 Jun 21, 2024
f7905e5
Add initial command templating for container engines
lbeckman314 Jul 23, 2024
edc1600
Add initial Docker/ContainerEngine tests
lbeckman314 Jul 23, 2024
9caa800
Merge branch 'develop' into feature/container-engines
lbeckman314 Jul 24, 2024
615b46a
Merge branch 'develop' into feature/container-engines
lbeckman314 Jul 24, 2024
b3e6066
Run `go mod tidy`
lbeckman314 Jul 24, 2024
20c5238
Update Github Actions
lbeckman314 Jul 24, 2024
80bf9a7
Update container engine IO and command execution
lbeckman314 Jul 25, 2024
0660edc
Re-enable all tests for container engines
lbeckman314 Jul 26, 2024
9e71330
Update test suite
lbeckman314 Jul 26, 2024
bd1e79b
Nextflow test debug
lbeckman314 Jul 26, 2024
59fce8b
Nextflow test debug
lbeckman314 Jul 26, 2024
d0f6824
Nextflow test debug
lbeckman314 Jul 26, 2024
90b69f4
Nextflow test debug
lbeckman314 Jul 26, 2024
d9fb95f
Update compliance test workflow
lbeckman314 Jul 26, 2024
60de248
Update S3 tests
lbeckman314 Jul 26, 2024
582b834
Update S3 tests
lbeckman314 Jul 26, 2024
f405231
Add comments and clean up debug statements
lbeckman314 Jul 26, 2024
d891fc3
Clean up code for 0.11.1-rc.1 release
lbeckman314 Jul 26, 2024
0bdd604
Add container command event to match existing pattern
lbeckman314 Jul 27, 2024
eac39ef
Update .goreleaser.yaml to replace deprecated fields
lbeckman314 Jul 27, 2024
d7272d4
Update Nextflow instructions
lbeckman314 Jul 31, 2024
87fbe0b
Update K8s support and documentation
lbeckman314 Sep 10, 2024
976aee0
Update README.md
lbeckman314 Sep 10, 2024
f5ed646
fix: add support for wildcards in AWS S3 paths
lbeckman314 Sep 12, 2024
42fe597
Add support for wildcards in AWS S3 output paths
lbeckman314 Sep 17, 2024
a570bf3
Update actions/upload-artifact to v4 in Github Actions
lbeckman314 Sep 18, 2024
119b554
Update version to 0.11.1-rc.4 in Makefile
lbeckman314 Sep 18, 2024
f8db3a5
Fix bug where FileMapper output was being overwritten in every loop
lbeckman314 Sep 19, 2024
6705410
Add initial Exacloud page to documentation
lbeckman314 May 6, 2024
59d806b
Update Exacloud support
lbeckman314 May 7, 2024
780e7ca
Clean up console debug output
lbeckman314 May 7, 2024
cff593d
Add default Worker engine ('docker')
lbeckman314 May 8, 2024
2759b97
Update configurable Container Engine commands
lbeckman314 May 9, 2024
ea70dfb
Revert changes to docker implementation and add engine interface
lbeckman314 May 10, 2024
71b1374
Update Exacloud/Container Engine implementation
lbeckman314 May 15, 2024
a233488
Update ContainerEngine interface
lbeckman314 May 16, 2024
4745850
Rename ContainerEngine to ContainerType
lbeckman314 May 16, 2024
2082c42
Add initial Exadocker unit test
lbeckman314 May 17, 2024
bbea59a
Update TaskService to pass config to Funnel worker
lbeckman314 May 17, 2024
6de2a83
Add small fix in HPC Template config
lbeckman314 May 17, 2024
6f008c5
Update worker config path in HPC Template
lbeckman314 May 17, 2024
2f9e8d1
Add debugging from Exacloud testing
lbeckman314 May 20, 2024
989a9bf
Update input/output working example (md5sum)
lbeckman314 May 24, 2024
7337d78
Update docker.go to implement ContainerEngine interface
lbeckman314 May 30, 2024
a19a2c4
Remove exadocker implementation in favor of docker
lbeckman314 May 30, 2024
93b637a
Add initial HPC documentation and example
lbeckman314 May 30, 2024
55f9895
Update docker and kin-openapi to compatible versions
lbeckman314 May 31, 2024
adbeda3
Update util/openapi2proto/main.go with latest kin-openapi version
lbeckman314 May 31, 2024
30e3b87
Update github.com/docker/docker to latest version
lbeckman314 May 31, 2024
6f59052
Update Docker client creation in tests
lbeckman314 May 31, 2024
4bc0775
Add `WithAPIVersionNegotiation` to docker client creation
lbeckman314 May 31, 2024
32598b2
Rename 'Driver' to 'DriverCommand' in ContainerConfig
lbeckman314 May 31, 2024
290de73
Fix minor linting errors
lbeckman314 Jun 1, 2024
775416c
Update GitHub Actions workflow (linting)
lbeckman314 Jun 1, 2024
ff6875a
fix: updated config check in hpc_backend.go
lbeckman314 Jun 1, 2024
afe98c6
Revert tabs/space change in storage/local.go
lbeckman314 Jun 1, 2024
5556bd0
Update output copying in scratch directory
lbeckman314 Jun 18, 2024
0cbd306
Update compliance-test.yaml
lbeckman314 Jun 18, 2024
a88fe62
Debug: add tmate step to Nextflow test
lbeckman314 Jun 20, 2024
34086dd
Update Nextflow tests
lbeckman314 Jun 20, 2024
5e1f1da
Update file copying behavior for Nextflow tests
lbeckman314 Jun 20, 2024
5b75b46
Update local file copying behavior to support directory dests
lbeckman314 Jun 20, 2024
8da896d
Update local dest for files with glob patterns
lbeckman314 Jun 20, 2024
064c1b1
Update Base64Encode test to match Github Actions test
lbeckman314 Jun 20, 2024
5441fc9
Fix Base64Encoding test value
lbeckman314 Jun 20, 2024
31748c0
Revert glob output change based on TesOutput spec
lbeckman314 Jun 21, 2024
627c17d
Debug: Add tmate step to Nextflow tests
lbeckman314 Jun 21, 2024
8715660
Update wildcard file output destination
lbeckman314 Jun 21, 2024
0593325
Add initial command templating for container engines
lbeckman314 Jul 23, 2024
f402761
Add initial Docker/ContainerEngine tests
lbeckman314 Jul 23, 2024
9ba3beb
Run `go mod tidy`
lbeckman314 Jul 24, 2024
64b0885
Update Github Actions
lbeckman314 Jul 24, 2024
b388751
Update container engine IO and command execution
lbeckman314 Jul 25, 2024
d13c7a1
Re-enable all tests for container engines
lbeckman314 Jul 26, 2024
5e37e48
Update test suite
lbeckman314 Jul 26, 2024
a1fece6
Nextflow test debug
lbeckman314 Jul 26, 2024
258bcf6
Nextflow test debug
lbeckman314 Jul 26, 2024
125986b
Nextflow test debug
lbeckman314 Jul 26, 2024
20ceb24
Nextflow test debug
lbeckman314 Jul 26, 2024
a8dd6c6
Update compliance test workflow
lbeckman314 Jul 26, 2024
206c75f
Update S3 tests
lbeckman314 Jul 26, 2024
b43867d
Update S3 tests
lbeckman314 Jul 26, 2024
e012d2f
Add comments and clean up debug statements
lbeckman314 Jul 26, 2024
983aad0
Clean up code for 0.11.1-rc.1 release
lbeckman314 Jul 26, 2024
666beee
Add container command event to match existing pattern
lbeckman314 Jul 27, 2024
532bc6b
Update .goreleaser.yaml to replace deprecated fields
lbeckman314 Jul 27, 2024
0912edc
Update Nextflow instructions
lbeckman314 Jul 31, 2024
1114f2c
Update K8s support and documentation
lbeckman314 Sep 10, 2024
a0c7a0c
Update README.md
lbeckman314 Sep 10, 2024
4effce6
fix: add support for wildcards in AWS S3 paths
lbeckman314 Sep 12, 2024
149b6d0
Add support for wildcards in AWS S3 output paths
lbeckman314 Sep 17, 2024
524ade6
Update actions/upload-artifact to v4 in Github Actions
lbeckman314 Sep 18, 2024
590a3e3
Update version to 0.11.1-rc.4 in Makefile
lbeckman314 Sep 18, 2024
2ec10d8
Fix bug where FileMapper output was being overwritten in every loop
lbeckman314 Sep 19, 2024
1a1ae94
Add initial search functionality to website
lbeckman314 Sep 30, 2024
e7d8cbf
Update GitHub Actions workflows
lbeckman314 Sep 30, 2024
234e934
Add Pagefind step to hugo.yaml
lbeckman314 Sep 30, 2024
c0f5920
Run `go mod tidy`
lbeckman314 Oct 1, 2024
1a32f86
Merge branch 'feature/k8s-support' into feature/container-engines
lbeckman314 Oct 1, 2024
1fa7ebe
Fix lint errors
lbeckman314 Oct 1, 2024
db7a5ac
debug: Slurm Github Action workflow
lbeckman314 Oct 1, 2024
56cba45
debug: Slurm GitHub Actions Workflow
lbeckman314 Oct 1, 2024
7d9742b
debug: Slurm GitHub Actions Workflow
lbeckman314 Oct 1, 2024
8de5041
debug: Slurm GitHub Actions Workflow
lbeckman314 Oct 1, 2024
8e39bd3
debug: Slurm GitHub Actions Workflow
lbeckman314 Oct 1, 2024
064a224
debug: Slurm GitHub Actions Workflow
lbeckman314 Oct 1, 2024
1a5bc8b
Add initial support for tag propagation (thank you @robertbio!)
lbeckman314 Oct 1, 2024
e8eef70
Merge branch 'develop' into feature/enable-tags
lbeckman314 Oct 3, 2024
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
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ type ContainerConfig struct {
RunCommand string // template string
PullCommand string // template string
StopCommand string // template string
EnableTags bool
Tags map[string]string
}

// HPCBackend describes the configuration for a HPC scheduler backend such as
Expand Down
27 changes: 19 additions & 8 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,30 @@ func DefaultConfig() Config {
LogUpdateRate: Duration(time.Second * 5),
LogTailSize: 10000,
MaxParallelTransfers: 10,
// `docker run` command flags
// https://docs.docker.com/reference/cli/docker/container/run/
Container: ContainerConfig{
DriverCommand: "docker",
RunCommand: "run -i --read-only " +
// Remove container after it exits
"{{if .RemoveContainer}}--rm{{end}} " +
"{{range $k, $v := .Env}}-e {{$k}}={{$v}} {{end}} " +

// Environment variables
"{{range $k, $v := .Env}}--env {{$k}}={{$v}} {{end}} " +

// Tags/Labels
"{{range $k, $v := .Tags}}--label {{$k}}={{$v}} {{end}} " +

// Container Name
"{{if .Name}}--name {{.Name}}{{end}} " +
"{{if .Workdir}}-w {{.Workdir}}{{end}} " +
"{{range .Volumes}}-v {{.HostPath}}:{{.ContainerPath}}:{{if .Readonly}}ro{{else}}rw{{end}} {{end}} " +

// Workdir
"{{if .Workdir}}--workdir {{.Workdir}}{{end}} " +

// Volumes
"{{range .Volumes}}--volume {{.HostPath}}:{{.ContainerPath}}:{{if .Readonly}}ro{{else}}rw{{end}} {{end}} " +

// Image and Command
"{{.Image}} {{.Command}}",
PullCommand: "pull {{.Image}}",
StopCommand: "rm -f {{.Name}}",
Expand Down Expand Up @@ -146,11 +162,6 @@ func DefaultConfig() Config {
c.AWSBatch.ReconcileRate = reconcile
c.AWSBatch.DisableReconciler = true

kubernetesTemplate := intern.MustAsset("config/kubernetes-template.yaml")
executorTemplate := intern.MustAsset("config/kubernetes-executor-template.yaml")
c.Kubernetes.Executor = "docker"
c.Kubernetes.Template = string(kubernetesTemplate)
c.Kubernetes.ExecutorTemplate = string(executorTemplate)
c.Kubernetes.ReconcileRate = reconcile

return c
Expand Down
7 changes: 7 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ require (
github.com/go-openapi/spec v0.21.0 // indirect
github.com/go-openapi/strfmt v0.23.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-openapi/validate v0.24.0 // indirect
github.com/go-restruct/restruct v1.2.0-alpha // indirect
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/glog v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
Expand All @@ -205,6 +211,7 @@ require (
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/google/wire v0.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions worker/container_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ type ContainerConfig struct {
RunCommand string // template string
PullCommand string // template string
StopCommand string // template string
EnableTags bool
Tags map[string]string
}

type ContainerVersion struct {
Expand Down
20 changes: 20 additions & 0 deletions worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"
"path/filepath"
"regexp"
"time"

"github.com/ohsu-comp-bio/funnel/config"
Expand Down Expand Up @@ -174,6 +175,8 @@ func (r *DefaultWorker) Run(pctx context.Context) (runerr error) {
containerConfig := ContainerConfig{
Image: d.Image,
Command: d.Command,
// TODO: Where is d.Env set?
// Do we need to sanitize these values as well?
Env: d.Env,
Volumes: mapper.Volumes,
Workdir: d.Workdir,
Expand All @@ -186,6 +189,15 @@ func (r *DefaultWorker) Run(pctx context.Context) (runerr error) {
containerConfig.RunCommand = r.Conf.Container.RunCommand
containerConfig.PullCommand = r.Conf.Container.PullCommand
containerConfig.StopCommand = r.Conf.Container.StopCommand

// Hide this behind explicit flag/option in configuration
if r.Conf.Container.EnableTags {
for k, v := range task.Tags {
safeTag := r.sanitizeValues(v)
containerConfig.Tags[k] = safeTag
}
}

containerEngine, err := f.NewContainerEngine(containerConfig)
if err != nil {
run.syserr = err
Expand Down Expand Up @@ -307,6 +319,14 @@ func (r *DefaultWorker) validate(mapper *FileMapper) error {
return nil
}

// Sanitizes the input string to avoid command injection.
// Only allows alphanumeric characters, dashes, underscores, and dots.
func (r *DefaultWorker) sanitizeValues(value string) string {
// Replace anything that is not an alphanumeric character, dash, underscore, or dot
re := regexp.MustCompile(`[^a-zA-Z0-9-_\.]`)
return re.ReplaceAllString(value, "")
}

func (r *DefaultWorker) pollForCancel(pctx context.Context, cancelCallback func()) context.Context {
taskctx, cancel := context.WithCancel(pctx)

Expand Down
Loading