From 5e0a64f9094fab0777d3c1f9868a74d544692eb6 Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Thu, 5 May 2022 13:25:50 +0000 Subject: [PATCH] Add license headers --- apiserver/controllers/controllers.go | 14 ++ apiserver/controllers/instances.go | 14 ++ apiserver/controllers/organizations.go | 14 ++ apiserver/controllers/pools.go | 14 ++ apiserver/controllers/repositories.go | 14 ++ apiserver/params/params.go | 14 ++ apiserver/routers/routers.go | 14 ++ auth/auth.go | 14 ++ auth/context.go | 14 ++ auth/init_required.go | 15 ++ auth/instance_middleware.go | 19 ++- auth/interfaces.go | 14 ++ auth/jwt.go | 14 ++ cloudconfig/cloudconfig.go | 14 ++ cloudconfig/templates.go | 14 ++ cmd/garm-cli/client/client.go | 14 ++ cmd/garm-cli/client/organizations.go | 14 ++ cmd/garm-cli/client/repositories.go | 14 ++ cmd/garm-cli/cmd/credentials.go | 16 +- cmd/garm-cli/cmd/init.go | 16 +- cmd/garm-cli/cmd/login.go | 16 +- cmd/garm-cli/cmd/org_instances.go | 14 ++ cmd/garm-cli/cmd/org_pool.go | 16 +- cmd/garm-cli/cmd/organization.go | 16 +- cmd/garm-cli/cmd/pool.go | 16 +- cmd/garm-cli/cmd/provider.go | 16 +- cmd/garm-cli/cmd/repo_instances.go | 14 ++ cmd/garm-cli/cmd/repo_pool.go | 16 +- cmd/garm-cli/cmd/repository.go | 16 +- cmd/garm-cli/cmd/root.go | 18 ++- cmd/garm-cli/cmd/runner.go | 16 +- cmd/garm-cli/common/common.go | 14 ++ cmd/garm-cli/config/config.go | 14 ++ cmd/garm-cli/config/home.go | 14 ++ cmd/garm-cli/main.go | 16 +- cmd/garm/create.go | 172 -------------------- cmd/garm/dbcreate.go | 214 ------------------------- cmd/garm/main.go | 14 ++ config/config.go | 14 ++ config/lxd.go | 14 ++ database/common/common.go | 14 ++ database/database.go | 14 ++ database/sql/controller.go | 14 ++ database/sql/instances.go | 14 ++ database/sql/models.go | 14 ++ database/sql/organizations.go | 14 ++ database/sql/pools.go | 14 ++ database/sql/repositories.go | 14 ++ database/sql/sql.go | 14 ++ database/sql/users.go | 14 ++ database/sql/util.go | 14 ++ errors/errors.go | 14 ++ params/github.go | 14 ++ params/params.go | 14 ++ params/requests.go | 14 ++ runner/common/pool.go | 14 ++ runner/common/provider.go | 14 ++ runner/organizations.go | 19 ++- runner/pool/common.go | 14 ++ runner/pool/interfaces.go | 14 ++ runner/pool/organization.go | 14 ++ runner/pool/repository.go | 14 ++ runner/pools.go | 14 ++ runner/providers/common/common.go | 14 ++ runner/providers/lxd/images.go | 14 ++ runner/providers/lxd/lxd.go | 14 ++ runner/providers/lxd/util.go | 17 +- runner/providers/providers.go | 15 ++ runner/repositories.go | 19 ++- runner/runner.go | 14 ++ runner/types.go | 14 ++ util/util.go | 24 ++- 72 files changed, 987 insertions(+), 435 deletions(-) delete mode 100644 cmd/garm/create.go delete mode 100644 cmd/garm/dbcreate.go diff --git a/apiserver/controllers/controllers.go b/apiserver/controllers/controllers.go index b8959d37..38027f9c 100644 --- a/apiserver/controllers/controllers.go +++ b/apiserver/controllers/controllers.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package controllers import ( diff --git a/apiserver/controllers/instances.go b/apiserver/controllers/instances.go index ff0d19e1..86518d44 100644 --- a/apiserver/controllers/instances.go +++ b/apiserver/controllers/instances.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package controllers import ( diff --git a/apiserver/controllers/organizations.go b/apiserver/controllers/organizations.go index 6c606a22..a76049c1 100644 --- a/apiserver/controllers/organizations.go +++ b/apiserver/controllers/organizations.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package controllers import ( diff --git a/apiserver/controllers/pools.go b/apiserver/controllers/pools.go index 1e035150..ebd0a8e0 100644 --- a/apiserver/controllers/pools.go +++ b/apiserver/controllers/pools.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package controllers import ( diff --git a/apiserver/controllers/repositories.go b/apiserver/controllers/repositories.go index 7bed8618..6bdb2af2 100644 --- a/apiserver/controllers/repositories.go +++ b/apiserver/controllers/repositories.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package controllers import ( diff --git a/apiserver/params/params.go b/apiserver/params/params.go index f367b824..23283a07 100644 --- a/apiserver/params/params.go +++ b/apiserver/params/params.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package params // APIErrorResponse holds information about an error, returned by the API diff --git a/apiserver/routers/routers.go b/apiserver/routers/routers.go index b562ba93..880a1508 100644 --- a/apiserver/routers/routers.go +++ b/apiserver/routers/routers.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package routers import ( diff --git a/auth/auth.go b/auth/auth.go index b0718bd5..3a8b819f 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package auth import ( diff --git a/auth/context.go b/auth/context.go index 50e10578..6d86b168 100644 --- a/auth/context.go +++ b/auth/context.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package auth import ( diff --git a/auth/init_required.go b/auth/init_required.go index 1a52e32d..cfa7438c 100644 --- a/auth/init_required.go +++ b/auth/init_required.go @@ -1,8 +1,23 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package auth import ( "encoding/json" "net/http" + "garm/apiserver/params" "garm/database/common" ) diff --git a/auth/instance_middleware.go b/auth/instance_middleware.go index e08a473c..319d1332 100644 --- a/auth/instance_middleware.go +++ b/auth/instance_middleware.go @@ -1,16 +1,31 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package auth import ( "context" "fmt" "net/http" + "strings" + "time" + "garm/config" dbCommon "garm/database/common" runnerErrors "garm/errors" "garm/params" "garm/runner/common" - "strings" - "time" "github.com/golang-jwt/jwt" "github.com/pkg/errors" diff --git a/auth/interfaces.go b/auth/interfaces.go index 5ae25cd8..fa5ca43c 100644 --- a/auth/interfaces.go +++ b/auth/interfaces.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package auth import "net/http" diff --git a/auth/jwt.go b/auth/jwt.go index 35d74a35..e43571cd 100644 --- a/auth/jwt.go +++ b/auth/jwt.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package auth import ( diff --git a/cloudconfig/cloudconfig.go b/cloudconfig/cloudconfig.go index 365488cc..e90baffc 100644 --- a/cloudconfig/cloudconfig.go +++ b/cloudconfig/cloudconfig.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package cloudconfig import ( diff --git a/cloudconfig/templates.go b/cloudconfig/templates.go index 04f92325..e83deffa 100644 --- a/cloudconfig/templates.go +++ b/cloudconfig/templates.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package cloudconfig import ( diff --git a/cmd/garm-cli/client/client.go b/cmd/garm-cli/client/client.go index 64f69376..e63bdf38 100644 --- a/cmd/garm-cli/client/client.go +++ b/cmd/garm-cli/client/client.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package client import ( diff --git a/cmd/garm-cli/client/organizations.go b/cmd/garm-cli/client/organizations.go index 8ef4a1ae..b20df34b 100644 --- a/cmd/garm-cli/client/organizations.go +++ b/cmd/garm-cli/client/organizations.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package client import ( diff --git a/cmd/garm-cli/client/repositories.go b/cmd/garm-cli/client/repositories.go index 0f0f614e..7b68c8a5 100644 --- a/cmd/garm-cli/client/repositories.go +++ b/cmd/garm-cli/client/repositories.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package client import ( diff --git a/cmd/garm-cli/cmd/credentials.go b/cmd/garm-cli/cmd/credentials.go index 05f2a0bc..4ecd8f47 100644 --- a/cmd/garm-cli/cmd/credentials.go +++ b/cmd/garm-cli/cmd/credentials.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( diff --git a/cmd/garm-cli/cmd/init.go b/cmd/garm-cli/cmd/init.go index 4d3eba51..dc0057c6 100644 --- a/cmd/garm-cli/cmd/init.go +++ b/cmd/garm-cli/cmd/init.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( diff --git a/cmd/garm-cli/cmd/login.go b/cmd/garm-cli/cmd/login.go index cbe92d0b..738e2edd 100644 --- a/cmd/garm-cli/cmd/login.go +++ b/cmd/garm-cli/cmd/login.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( diff --git a/cmd/garm-cli/cmd/org_instances.go b/cmd/garm-cli/cmd/org_instances.go index 4d1f3199..4c8445d7 100644 --- a/cmd/garm-cli/cmd/org_instances.go +++ b/cmd/garm-cli/cmd/org_instances.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package cmd import ( diff --git a/cmd/garm-cli/cmd/org_pool.go b/cmd/garm-cli/cmd/org_pool.go index 26720565..976f5c79 100644 --- a/cmd/garm-cli/cmd/org_pool.go +++ b/cmd/garm-cli/cmd/org_pool.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( diff --git a/cmd/garm-cli/cmd/organization.go b/cmd/garm-cli/cmd/organization.go index 65850c67..f2f629c0 100644 --- a/cmd/garm-cli/cmd/organization.go +++ b/cmd/garm-cli/cmd/organization.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( diff --git a/cmd/garm-cli/cmd/pool.go b/cmd/garm-cli/cmd/pool.go index 17f68f10..4d30abba 100644 --- a/cmd/garm-cli/cmd/pool.go +++ b/cmd/garm-cli/cmd/pool.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( diff --git a/cmd/garm-cli/cmd/provider.go b/cmd/garm-cli/cmd/provider.go index 30eeee10..562f9462 100644 --- a/cmd/garm-cli/cmd/provider.go +++ b/cmd/garm-cli/cmd/provider.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( diff --git a/cmd/garm-cli/cmd/repo_instances.go b/cmd/garm-cli/cmd/repo_instances.go index 4a38a81c..ee3c513a 100644 --- a/cmd/garm-cli/cmd/repo_instances.go +++ b/cmd/garm-cli/cmd/repo_instances.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package cmd import ( diff --git a/cmd/garm-cli/cmd/repo_pool.go b/cmd/garm-cli/cmd/repo_pool.go index 33c8f2b8..80b3058d 100644 --- a/cmd/garm-cli/cmd/repo_pool.go +++ b/cmd/garm-cli/cmd/repo_pool.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( diff --git a/cmd/garm-cli/cmd/repository.go b/cmd/garm-cli/cmd/repository.go index eef69d83..02d3543b 100644 --- a/cmd/garm-cli/cmd/repository.go +++ b/cmd/garm-cli/cmd/repository.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( diff --git a/cmd/garm-cli/cmd/root.go b/cmd/garm-cli/cmd/root.go index 7b11d8ff..79df3236 100644 --- a/cmd/garm-cli/cmd/root.go +++ b/cmd/garm-cli/cmd/root.go @@ -1,14 +1,24 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( "fmt" - "os" "garm/cmd/garm-cli/client" "garm/cmd/garm-cli/config" + "os" "github.com/spf13/cobra" ) diff --git a/cmd/garm-cli/cmd/runner.go b/cmd/garm-cli/cmd/runner.go index c8a98992..23478d27 100644 --- a/cmd/garm-cli/cmd/runner.go +++ b/cmd/garm-cli/cmd/runner.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package cmd import ( diff --git a/cmd/garm-cli/common/common.go b/cmd/garm-cli/common/common.go index b987ad96..8164b9a7 100644 --- a/cmd/garm-cli/common/common.go +++ b/cmd/garm-cli/common/common.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package common import ( diff --git a/cmd/garm-cli/config/config.go b/cmd/garm-cli/config/config.go index 48e65873..6192ac89 100644 --- a/cmd/garm-cli/config/config.go +++ b/cmd/garm-cli/config/config.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package config import ( diff --git a/cmd/garm-cli/config/home.go b/cmd/garm-cli/config/home.go index dc76b95f..b6043289 100644 --- a/cmd/garm-cli/config/home.go +++ b/cmd/garm-cli/config/home.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package config import ( diff --git a/cmd/garm-cli/main.go b/cmd/garm-cli/main.go index 521ebd69..3a9683be 100644 --- a/cmd/garm-cli/main.go +++ b/cmd/garm-cli/main.go @@ -1,7 +1,17 @@ -/* -Copyright © 2022 NAME HERE +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. -*/ package main import "garm/cmd/garm-cli/cmd" diff --git a/cmd/garm/create.go b/cmd/garm/create.go deleted file mode 100644 index cdeff596..00000000 --- a/cmd/garm/create.go +++ /dev/null @@ -1,172 +0,0 @@ -package main - -// import ( -// "context" -// "flag" -// "fmt" -// "log" -// "os/signal" - -// "garm/config" -// "garm/params" -// "garm/runner/providers/lxd" -// "garm/util" - -// "github.com/google/go-github/v43/github" -// "golang.org/x/oauth2" -// "gopkg.in/yaml.v3" -// ) - -// var ( -// conf = flag.String("config", config.DefaultConfigFilePath, "garm config file") -// version = flag.Bool("version", false, "prints version") -// ) - -// var Version string - -// // var token = "super secret token" - -// func main() { -// flag.Parse() -// if *version { -// fmt.Println(Version) -// return -// } -// ctx, stop := signal.NotifyContext(context.Background(), signals...) -// defer stop() -// fmt.Println(ctx) - -// cfg, err := config.NewConfig(*conf) -// if err != nil { -// log.Fatalf("Fetching config: %+v", err) -// } - -// ts := oauth2.StaticTokenSource( -// &oauth2.Token{AccessToken: cfg.Github.OAuth2Token}, -// ) - -// tc := oauth2.NewClient(ctx, ts) - -// ghClient := github.NewClient(tc) - -// // // list all repositories for the authenticated user -// // repos, _, err := client.Repositories.List(ctx, "", nil) - -// // fmt.Println(repos, err) - -// logWriter, err := util.GetLoggingWriter(cfg) -// if err != nil { -// log.Fatalf("fetching log writer: %+v", err) -// } -// log.SetOutput(logWriter) - -// // controller, err := controllers.NewAPIController() -// // if err != nil { -// // log.Fatalf("failed to create controller: %+v", err) -// // } - -// // router := routers.NewAPIRouter(controller, logWriter) - -// // tlsCfg, err := cfg.APIServer.APITLSConfig() -// // if err != nil { -// // log.Fatalf("failed to get TLS config: %q", err) -// // } - -// // srv := &http.Server{ -// // Addr: cfg.APIServer.BindAddress(), -// // TLSConfig: tlsCfg, -// // // Pass our instance of gorilla/mux in. -// // Handler: router, -// // } - -// // listener, err := net.Listen("tcp", srv.Addr) -// // if err != nil { -// // log.Fatalf("creating listener: %q", err) -// // } - -// // go func() { -// // if err := srv.Serve(listener); err != nil { -// // log.Fatalf("Listening: %+v", err) -// // } -// // }() - -// // <-ctx.Done() - -// // runner, err := runner.NewRunner(ctx, *cfg) -// // if err != nil { -// // log.Fatal(err) -// // } - -// // fmt.Println(runner) -// controllerID := "026d374d-6a8a-4241-8ed9-a246fff6762f" -// provider, err := lxd.NewProvider(ctx, &cfg.Providers[0], controllerID) -// if err != nil { -// log.Fatal(err) -// } - -// // if err := provider.RemoveAllInstances(ctx); err != nil { -// // log.Fatal(err) -// // } - -// // fmt.Println(provider) - -// // if err := provider.DeleteInstance(ctx, "garm-2fbe5354-be28-4e00-95a8-11479912368d"); err != nil { -// // log.Fatal(err) -// // } - -// // instances, err := provider.ListInstances(ctx) - -// // asJs, err := json.MarshalIndent(instances, "", " ") -// // fmt.Println(string(asJs), err) - -// log.Print("Fetching tools") -// tools, _, err := ghClient.Actions.ListOrganizationRunnerApplicationDownloads(ctx, cfg.Organizations[0].Name) -// // tools, _, err := ghClient.Actions.ListRunnerApplicationDownloads(ctx, cfg.Repositories[0].Owner, cfg.Repositories[0].Name) -// if err != nil { -// log.Fatal(err) -// } - -// tk, _, err := ghClient.Actions.CreateOrganizationRegistrationToken(ctx, "gsamfira") - -// if err != nil { -// log.Fatalf("fetching org token: %+v", err) -// } - -// fmt.Printf("Org token is: %v\n", *tk) - -// toolsAsYaml, err := yaml.Marshal(tools) -// if err != nil { -// log.Fatal(err) -// } -// log.Printf("got tools:\n%s\n", string(toolsAsYaml)) - -// log.Print("fetching runner token") -// ghRunnerToken, _, err := ghClient.Actions.CreateRegistrationToken(ctx, cfg.Repositories[0].Owner, cfg.Repositories[0].Name) -// if err != nil { -// log.Fatal(err) -// } -// log.Printf("got token %v", ghRunnerToken) - -// bootstrapArgs := params.BootstrapInstance{ -// Tools: tools, -// RepoURL: cfg.Organizations[0].String(), -// GithubRunnerAccessToken: *tk.Token, -// RunnerType: cfg.Repositories[0].Pool.Runners[0].Name, -// CallbackURL: "", -// InstanceToken: "", -// OSArch: config.Amd64, -// Flavor: cfg.Organizations[0].Pool.Runners[0].Flavor, -// Image: cfg.Organizations[0].Pool.Runners[0].Image, -// Labels: cfg.Organizations[0].Pool.Runners[0].Labels, -// SSHKeys: []string{ -// "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC2oT7j/+elHY9U2ibgk2RYJgCvqIwewYKJTtHslTQFDWlHLeDam93BBOFlQJm9/wKX/qjC8d26qyzjeeeVf2EEAztp+jQfEq9OU+EtgQUi589jxtVmaWuYED8KVNbzLuP79SrBtEZD4xqgmnNotPhRshh3L6eYj4XzLWDUuOD6kzNdsJA2QOKeMOIFpBN6urKJHRHYD+oUPUX1w5QMv1W1Srlffl4m5uE+0eJYAMr02980PG4+jS4bzM170wYdWwUI0pSZsEDC8Fn7jef6QARU2CgHJYlaTem+KWSXislOUTaCpR0uhakP1ezebW20yuuc3bdRNgSlZi9B7zAPALGZpOshVqwF+KmLDi6XiFwG+NnwAFa6zaQfhOxhw/rF5Jk/wVjHIHkNNvYewycZPbKui0E3QrdVtR908N3VsPtLhMQ59BEMl3xlURSi0fiOU3UjnwmOkOoFDy/WT8qk//gFD93tUxlf4eKXDgNfME3zNz8nVi2uCPvG5NT/P/VWR8NMqW6tZcmWyswM/GgL6Y84JQ3ESZq/7WvAetdc1gVIDQJ2ejYbSHBcQpWvkocsiuMTCwiEvQ0sr+UE5jmecQvLPUyXOhuMhw43CwxnLk1ZSeYeCorxbskyqIXH71o8zhbPoPiEbwgB+i9WEoq02u7c8CmCmO8Y9aOnh8MzTKxIgQ==", -// }, -// } - -// instance, err := provider.CreateInstance(ctx, bootstrapArgs) -// if err != nil { -// log.Fatal(err) -// } - -// fmt.Println(instance) -// } diff --git a/cmd/garm/dbcreate.go b/cmd/garm/dbcreate.go deleted file mode 100644 index 5e2a8586..00000000 --- a/cmd/garm/dbcreate.go +++ /dev/null @@ -1,214 +0,0 @@ -package main - -// import ( -// "context" -// "flag" -// "fmt" -// "log" -// "os/signal" -// "garm/config" -// "garm/database/sql" -// "garm/params" -// "garm/util" -// ) - -// var ( -// conf = flag.String("config", config.DefaultConfigFilePath, "garm config file") -// version = flag.Bool("version", false, "prints version") -// ) - -// var Version string - -// func main() { -// flag.Parse() -// if *version { -// fmt.Println(Version) -// return -// } -// ctx, stop := signal.NotifyContext(context.Background(), signals...) -// defer stop() -// fmt.Println(ctx) - -// cfg, err := config.NewConfig(*conf) -// if err != nil { -// log.Fatalf("Fetching config: %+v", err) -// } - -// db, err := sql.NewSQLDatabase(ctx, cfg.Database) -// if err != nil { -// log.Fatal(err) -// } - -// fmt.Println(db) - -// txt := "ana are mere prune și alune" - -// enc, err := util.Aes256EncodeString(txt, "pamkotepAyksemfeghoibidEwCivbaut") -// if err != nil { -// log.Fatal(err) -// } - -// fmt.Printf("encrypted: %d\n", len(enc)) - -// dec, err := util.Aes256DecodeString(enc, "pamkotepAyksemfeghoibidEwCivbaut") -// if err != nil { -// log.Fatal(err) -// } - -// fmt.Println(dec) - -// repo, err := db.CreateRepository(ctx, "gabriel-samfira", "", "scripts", "") -// if err != nil { -// log.Fatal(err) -// } - -// pool, err := db.CreateRepositoryPool(ctx, repo.ID, params.CreatePoolParams{ -// ProviderName: "lxd_local", -// MaxRunners: 10, -// MinIdleRunners: 1, -// Image: "ubuntu:20.04", -// Flavor: "default", -// Tags: []string{ -// "myrunner", -// "superAwesome", -// }, -// OSType: config.Linux, -// OSArch: config.Amd64, -// }) -// if err != nil { -// log.Fatal(err) -// } -// fmt.Println(pool) - -// pool2, err := db.CreateRepositoryPool(ctx, repo.ID, params.CreatePoolParams{ -// ProviderName: "lxd_local2",package main - -// import ( -// "context" -// "flag" -// "fmt" -// "log" -// "os/signal" -// "garm/config" -// "garm/database/sql" -// "garm/params" -// "garm/util" -// ) - -// var ( -// conf = flag.String("config", config.DefaultConfigFilePath, "garm config file") -// version = flag.Bool("version", false, "prints version") -// ) - -// var Version string - -// func main() { -// flag.Parse() -// if *version { -// fmt.Println(Version) -// return -// } -// ctx, stop := signal.NotifyContext(context.Background(), signals...) -// defer stop() -// fmt.Println(ctx) - -// cfg, err := config.NewConfig(*conf) -// if err != nil { -// log.Fatalf("Fetching config: %+v", err) -// } - -// db, err := sql.NewSQLDatabase(ctx, cfg.Database) -// if err != nil { -// log.Fatal(err) -// } - -// fmt.Println(db) - -// txt := "ana are mere prune și alune" - -// enc, err := util.Aes256EncodeString(txt, "pamkotepAyksemfeghoibidEwCivbaut") -// if err != nil { -// log.Fatal(err) -// } - -// fmt.Printf("encrypted: %d\n", len(enc)) - -// dec, err := util.Aes256DecodeString(enc, "pamkotepAyksemfeghoibidEwCivbaut") -// if err != nil { -// log.Fatal(err) -// } - -// fmt.Println(dec) - -// repo, err := db.CreateRepository(ctx, "gabriel-samfira", "", "scripts", "") -// if err != nil { -// log.Fatal(err) -// } - -// pool, err := db.CreateRepositoryPool(ctx, repo.ID, params.CreatePoolParams{ -// ProviderName: "lxd_local", -// MaxRunners: 10, -// MinIdleRunners: 1, -// Image: "ubuntu:20.04", -// Flavor: "default", -// Tags: []string{ -// "myrunner", -// "superAwesome", -// }, -// OSType: config.Linux, -// OSArch: config.Amd64, -// }) -// if err != nil { -// log.Fatal(err) -// } -// fmt.Println(pool) - -// pool2, err := db.CreateRepositoryPool(ctx, repo.ID, params.CreatePoolParams{ -// ProviderName: "lxd_local2", -// MaxRunners: 10, -// MinIdleRunners: 1, -// Image: "ubuntu:20.04", -// Flavor: "default", -// Tags: []string{ -// "myrunner", -// "superAwesome2", -// }, -// OSType: config.Linux, -// OSArch: config.Amd64, -// }) -// if err != nil { -// log.Fatal(err) -// } -// fmt.Println(pool2) - -// pool3, err := db.FindRepositoryPoolByTags(ctx, repo.ID, []string{"myrunner", "superAwesome2"}) -// if err != nil { -// log.Fatal(err) -// } - -// fmt.Println(pool3) -// } - -// MaxRunners: 10, -// MinIdleRunners: 1, -// Image: "ubuntu:20.04", -// Flavor: "default", -// Tags: []string{ -// "myrunner", -// "superAwesome2", -// }, -// OSType: config.Linux, -// OSArch: config.Amd64, -// }) -// if err != nil { -// log.Fatal(err) -// } -// fmt.Println(pool2) - -// pool3, err := db.FindRepositoryPoolByTags(ctx, repo.ID, []string{"myrunner", "superAwesome2"}) -// if err != nil { -// log.Fatal(err) -// } - -// fmt.Println(pool3) -// } diff --git a/cmd/garm/main.go b/cmd/garm/main.go index 83ec1aa4..6b85a4ed 100644 --- a/cmd/garm/main.go +++ b/cmd/garm/main.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package main import ( diff --git a/config/config.go b/config/config.go index 5c3214d0..b54b192e 100644 --- a/config/config.go +++ b/config/config.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package config import ( diff --git a/config/lxd.go b/config/lxd.go index 47c7695c..fe2604f6 100644 --- a/config/lxd.go +++ b/config/lxd.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package config import ( diff --git a/database/common/common.go b/database/common/common.go index 2cf38207..f3bc5b32 100644 --- a/database/common/common.go +++ b/database/common/common.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package common import ( diff --git a/database/database.go b/database/database.go index 33f3b760..39d57d10 100644 --- a/database/database.go +++ b/database/database.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package database import ( diff --git a/database/sql/controller.go b/database/sql/controller.go index c54147c3..c71d1d7a 100644 --- a/database/sql/controller.go +++ b/database/sql/controller.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package sql import ( diff --git a/database/sql/instances.go b/database/sql/instances.go index acfa489d..727b447d 100644 --- a/database/sql/instances.go +++ b/database/sql/instances.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package sql import ( diff --git a/database/sql/models.go b/database/sql/models.go index cd3f4126..66dbecd8 100644 --- a/database/sql/models.go +++ b/database/sql/models.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package sql import ( diff --git a/database/sql/organizations.go b/database/sql/organizations.go index c639d962..21e02706 100644 --- a/database/sql/organizations.go +++ b/database/sql/organizations.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package sql import ( diff --git a/database/sql/pools.go b/database/sql/pools.go index 7ac6dc2f..aac66a93 100644 --- a/database/sql/pools.go +++ b/database/sql/pools.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package sql import ( diff --git a/database/sql/repositories.go b/database/sql/repositories.go index 78ebe04e..70592d8e 100644 --- a/database/sql/repositories.go +++ b/database/sql/repositories.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package sql import ( diff --git a/database/sql/sql.go b/database/sql/sql.go index 9600c944..6959a750 100644 --- a/database/sql/sql.go +++ b/database/sql/sql.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package sql import ( diff --git a/database/sql/users.go b/database/sql/users.go index d60604df..24e10f02 100644 --- a/database/sql/users.go +++ b/database/sql/users.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package sql import ( diff --git a/database/sql/util.go b/database/sql/util.go index 79f96cc9..b9eb3339 100644 --- a/database/sql/util.go +++ b/database/sql/util.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package sql import ( diff --git a/errors/errors.go b/errors/errors.go index 2385f4ba..20c0245d 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package errors import "fmt" diff --git a/params/github.go b/params/github.go index df894aba..fc4b1c59 100644 --- a/params/github.go +++ b/params/github.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package params import "time" diff --git a/params/params.go b/params/params.go index a638aff8..37b81db6 100644 --- a/params/params.go +++ b/params/params.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package params import ( diff --git a/params/requests.go b/params/requests.go index c1940aa0..9cd43d6d 100644 --- a/params/requests.go +++ b/params/requests.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package params import ( diff --git a/runner/common/pool.go b/runner/common/pool.go index 32dcec31..9165db62 100644 --- a/runner/common/pool.go +++ b/runner/common/pool.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package common import ( diff --git a/runner/common/provider.go b/runner/common/provider.go index 0e8813b2..510f4b3f 100644 --- a/runner/common/provider.go +++ b/runner/common/provider.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package common import ( diff --git a/runner/organizations.go b/runner/organizations.go index 9a4af5ce..2897df06 100644 --- a/runner/organizations.go +++ b/runner/organizations.go @@ -1,14 +1,29 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package runner import ( "context" + "log" + "strings" + "garm/auth" runnerErrors "garm/errors" "garm/params" "garm/runner/common" "garm/runner/pool" - "log" - "strings" "github.com/pkg/errors" ) diff --git a/runner/pool/common.go b/runner/pool/common.go index f85a6cd6..2043af68 100644 --- a/runner/pool/common.go +++ b/runner/pool/common.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package pool import ( diff --git a/runner/pool/interfaces.go b/runner/pool/interfaces.go index 5517c636..08a2bfd5 100644 --- a/runner/pool/interfaces.go +++ b/runner/pool/interfaces.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package pool import ( diff --git a/runner/pool/organization.go b/runner/pool/organization.go index 63bf01fc..e51e2247 100644 --- a/runner/pool/organization.go +++ b/runner/pool/organization.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package pool import ( diff --git a/runner/pool/repository.go b/runner/pool/repository.go index 0cf820b4..02a27b2c 100644 --- a/runner/pool/repository.go +++ b/runner/pool/repository.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package pool import ( diff --git a/runner/pools.go b/runner/pools.go index b4e3eaba..81656ddf 100644 --- a/runner/pools.go +++ b/runner/pools.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package runner import ( diff --git a/runner/providers/common/common.go b/runner/providers/common/common.go index 90804a38..5f1dcb5c 100644 --- a/runner/providers/common/common.go +++ b/runner/providers/common/common.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package common type InstanceStatus string diff --git a/runner/providers/lxd/images.go b/runner/providers/lxd/images.go index 8dfd4445..f305c6c2 100644 --- a/runner/providers/lxd/images.go +++ b/runner/providers/lxd/images.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package lxd import ( diff --git a/runner/providers/lxd/lxd.go b/runner/providers/lxd/lxd.go index b2fa4ffb..313631ec 100644 --- a/runner/providers/lxd/lxd.go +++ b/runner/providers/lxd/lxd.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package lxd import ( diff --git a/runner/providers/lxd/util.go b/runner/providers/lxd/util.go index 6f4d404b..446c5e0a 100644 --- a/runner/providers/lxd/util.go +++ b/runner/providers/lxd/util.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package lxd import ( @@ -8,11 +22,12 @@ import ( "log" "net/http" "os" + "strings" + "garm/config" "garm/params" "garm/runner/providers/common" "garm/util" - "strings" lxd "github.com/lxc/lxd/client" "github.com/lxc/lxd/shared/api" diff --git a/runner/providers/providers.go b/runner/providers/providers.go index b1a3c961..7258090a 100644 --- a/runner/providers/providers.go +++ b/runner/providers/providers.go @@ -1,8 +1,23 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package providers import ( "context" "log" + "garm/config" "garm/runner/common" "garm/runner/providers/lxd" diff --git a/runner/repositories.go b/runner/repositories.go index 6b64bf50..347056ec 100644 --- a/runner/repositories.go +++ b/runner/repositories.go @@ -1,14 +1,29 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package runner import ( "context" + "log" + "strings" + "garm/auth" runnerErrors "garm/errors" "garm/params" "garm/runner/common" "garm/runner/pool" - "log" - "strings" "github.com/pkg/errors" ) diff --git a/runner/runner.go b/runner/runner.go index 360b2741..82046906 100644 --- a/runner/runner.go +++ b/runner/runner.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package runner import ( diff --git a/runner/types.go b/runner/types.go index 169a0452..96efcd24 100644 --- a/runner/types.go +++ b/runner/types.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package runner import "garm/config" diff --git a/util/util.go b/util/util.go index 758b8aff..be441c81 100644 --- a/util/util.go +++ b/util/util.go @@ -1,3 +1,17 @@ +// Copyright 2022 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package util import ( @@ -19,6 +33,11 @@ import ( "strings" "unicode" + "garm/cloudconfig" + "garm/config" + runnerErrors "garm/errors" + "garm/params" + "github.com/google/go-github/v43/github" "github.com/pkg/errors" "golang.org/x/crypto/bcrypt" @@ -28,11 +47,6 @@ import ( "gorm.io/driver/mysql" "gorm.io/driver/sqlite" "gorm.io/gorm" - - "garm/cloudconfig" - "garm/config" - runnerErrors "garm/errors" - "garm/params" ) const alphanumeric = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"