Compare commits
No commits in common. "3c28c8cdd9cb24f90afe6cf34d3f5f66c1610441" and "dfbd70b3266c962e7e1ea781e99f6a59fc9f7b16" have entirely different histories.
3c28c8cdd9
...
dfbd70b326
|
@ -17,7 +17,7 @@ func main() {
|
||||||
|
|
||||||
// Init tasks
|
// Init tasks
|
||||||
taskItems := []common.Tasker{
|
taskItems := []common.Tasker{
|
||||||
tasks.NewListRepositoryMenuTask(config),
|
tasks.NewListRepositoriesTask(config),
|
||||||
tasks.NewGenerateJwtTokenTask(config),
|
tasks.NewGenerateJwtTokenTask(config),
|
||||||
tasks.NewCurlLookupTask(),
|
tasks.NewCurlLookupTask(),
|
||||||
tasks.NewCodeSecurityScanTask(),
|
tasks.NewCodeSecurityScanTask(),
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
package agent
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
"ocl/portainer-devtool/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
type BuildDockerImageSubTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewBuildDockerImageSubTask(cfg *configs.Config) *BuildDockerImageSubTask {
|
|
||||||
return &BuildDockerImageSubTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *BuildDockerImageSubTask) Execute() error {
|
|
||||||
utils.SuccessPrint(`
|
|
||||||
./dev.sh compile
|
|
||||||
./dev.sh build
|
|
||||||
`)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *BuildDockerImageSubTask) String() string {
|
|
||||||
return "Build Docker Image"
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package agent
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
)
|
|
||||||
|
|
||||||
type MenuSubTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewMenuSubTask(cfg *configs.Config) *MenuSubTask {
|
|
||||||
return &MenuSubTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *MenuSubTask) Execute() error {
|
|
||||||
subTaskItems := []common.Tasker{
|
|
||||||
NewBuildDockerImageSubTask(task.Config),
|
|
||||||
NewPushImageSubTask(task.Config),
|
|
||||||
}
|
|
||||||
|
|
||||||
common.ListCommandMenu(subTaskItems, "Which management commands do you want to choose:", false, task.ParentTasks)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *MenuSubTask) String() string {
|
|
||||||
return "agent"
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package agent
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
"ocl/portainer-devtool/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PushImageSubTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPushImageSubTask(cfg *configs.Config) *PushImageSubTask {
|
|
||||||
return &PushImageSubTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *PushImageSubTask) Execute() error {
|
|
||||||
utils.SuccessPrint(`
|
|
||||||
export CR_PAT=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
|
|
||||||
echo $CR_PAT | docker login ghcr.io -u oscarzhou-portainer --password-stdin
|
|
||||||
docker image tag portainerci/agent:develop-78af729 ghcr.io/oscarzhou-portainer/agent:develop-78af729
|
|
||||||
docker push ghcr.io/oscarzhou-portainer/agent:develop-78af729docker
|
|
||||||
`)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *PushImageSubTask) String() string {
|
|
||||||
return "Push Docker Image"
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package portaineree
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
"ocl/portainer-devtool/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
type BuildDockerImageSubTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewBuildDockerImageSubTask(cfg *configs.Config) *BuildDockerImageSubTask {
|
|
||||||
return &BuildDockerImageSubTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *BuildDockerImageSubTask) Execute() error {
|
|
||||||
utils.SuccessPrint(`
|
|
||||||
yarn build
|
|
||||||
docker build -t "portainerci/portainer:ee4803" -f build/linux/Dockerfile .
|
|
||||||
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v "/var/run/docker.sock:/var/run/docker.sock" -v ${env:HOME}/volume/portainer-ee-data-2:/data --add-host=host.docker.internal:host-gateway portainerci/portainer:ee4803
|
|
||||||
`)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *BuildDockerImageSubTask) String() string {
|
|
||||||
return "Build Docker Image"
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package portaineree
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
)
|
|
||||||
|
|
||||||
type MenuSubTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewMenuSubTask(cfg *configs.Config) *MenuSubTask {
|
|
||||||
return &MenuSubTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *MenuSubTask) Execute() error {
|
|
||||||
subTaskItems := []common.Tasker{
|
|
||||||
NewBuildDockerImageSubTask(task.Config),
|
|
||||||
}
|
|
||||||
|
|
||||||
common.ListCommandMenu(subTaskItems, "Which management commands do you want to choose:", false, task.ParentTasks)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *MenuSubTask) String() string {
|
|
||||||
return "portainer-ee"
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package unpacker
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
)
|
|
||||||
|
|
||||||
type MenuSubTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewMenuSubTask(cfg *configs.Config) *MenuSubTask {
|
|
||||||
return &MenuSubTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *MenuSubTask) Execute() error {
|
|
||||||
subTaskItems := []common.Tasker{
|
|
||||||
NewBuildDockerImageSubTask(task.Config),
|
|
||||||
}
|
|
||||||
|
|
||||||
common.ListCommandMenu(subTaskItems, "Which management commands do you want to choose:", false, task.ParentTasks)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *MenuSubTask) String() string {
|
|
||||||
return "unpacker"
|
|
||||||
}
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package tasks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"ocl/portainer-devtool/configs"
|
||||||
|
"ocl/portainer-devtool/repositories/unpacker"
|
||||||
|
"ocl/portainer-devtool/tasks/common"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ListRepoActionsSubTask struct {
|
||||||
|
Config *configs.Config
|
||||||
|
ParentTasks []common.Tasker
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewListRepoActionsSubTask(cfg *configs.Config) *ListRepoActionsSubTask {
|
||||||
|
return &ListRepoActionsSubTask{
|
||||||
|
Config: cfg,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (task *ListRepoActionsSubTask) Execute() error {
|
||||||
|
subTaskItems := []common.Tasker{
|
||||||
|
unpacker.NewBuildDockerImageSubTask(task.Config),
|
||||||
|
}
|
||||||
|
|
||||||
|
common.ListCommandMenu(subTaskItems, "Which management commands do you want to choose:", false, task.ParentTasks)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (task *ListRepoActionsSubTask) SetParentTaskers(tasks []common.Tasker) {
|
||||||
|
task.ParentTasks = tasks
|
||||||
|
}
|
||||||
|
|
||||||
|
func (task *ListRepoActionsSubTask) String() string {
|
||||||
|
return "Choose Repository Commands"
|
||||||
|
}
|
|
@ -1,39 +0,0 @@
|
||||||
package tasks
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/repositories/agent"
|
|
||||||
portaineree "ocl/portainer-devtool/repositories/portainer-ee"
|
|
||||||
"ocl/portainer-devtool/repositories/unpacker"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ListRepositoryMenuTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewListRepositoryMenuTask(cfg *configs.Config) *ListRepositoryMenuTask {
|
|
||||||
return &ListRepositoryMenuTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *ListRepositoryMenuTask) Execute() error {
|
|
||||||
subTaskItems := []common.Tasker{
|
|
||||||
portaineree.NewMenuSubTask(task.Config),
|
|
||||||
agent.NewMenuSubTask(task.Config),
|
|
||||||
unpacker.NewMenuSubTask(task.Config),
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, taskItem := range subTaskItems {
|
|
||||||
taskItem.SetParentTaskers(subTaskItems)
|
|
||||||
}
|
|
||||||
|
|
||||||
common.ListCommandMenu(subTaskItems, "Which management commands do you want to choose:", false, task.ParentTasks)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *ListRepositoryMenuTask) String() string {
|
|
||||||
return "Choose Repositories"
|
|
||||||
}
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package tasks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"ocl/portainer-devtool/configs"
|
||||||
|
"ocl/portainer-devtool/tasks/common"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ListRepositoriesTask struct {
|
||||||
|
common.GeneralTask
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewListRepositoriesTask(cfg *configs.Config) *ListRepositoriesTask {
|
||||||
|
return &ListRepositoriesTask{
|
||||||
|
GeneralTask: *common.NewGeneralTask(cfg),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (task *ListRepositoriesTask) Execute() error {
|
||||||
|
subTaskItems := []common.Tasker{
|
||||||
|
NewListRepoActionsSubTask(task.Config),
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, taskItem := range subTaskItems {
|
||||||
|
taskItem.SetParentTaskers(subTaskItems)
|
||||||
|
}
|
||||||
|
|
||||||
|
common.ListCommandMenu(subTaskItems, "Which management commands do you want to choose:", false, task.ParentTasks)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (task *ListRepositoriesTask) String() string {
|
||||||
|
return "List All Repositories"
|
||||||
|
}
|
Loading…
Reference in New Issue