Compare commits
No commits in common. "82906eb832742530c37a7654f089086f95b2ab09" and "3c28c8cdd9cb24f90afe6cf34d3f5f66c1610441" have entirely different histories.
82906eb832
...
3c28c8cdd9
@ -18,9 +18,7 @@ func main() {
|
|||||||
// Init tasks
|
// Init tasks
|
||||||
taskItems := []common.Tasker{
|
taskItems := []common.Tasker{
|
||||||
tasks.NewListRepositoryMenuTask(config),
|
tasks.NewListRepositoryMenuTask(config),
|
||||||
tasks.NewListOperationMenuTask(config),
|
|
||||||
tasks.NewGenerateJwtTokenTask(config),
|
tasks.NewGenerateJwtTokenTask(config),
|
||||||
tasks.NewTestEnvironmentTask(),
|
|
||||||
tasks.NewCurlLookupTask(),
|
tasks.NewCurlLookupTask(),
|
||||||
tasks.NewCodeSecurityScanTask(),
|
tasks.NewCodeSecurityScanTask(),
|
||||||
tasks.NewListDevToolCommandTask(config),
|
tasks.NewListDevToolCommandTask(config),
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
package edgestack
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
)
|
|
||||||
|
|
||||||
type OperationMenuSubTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewOperationMenuSubTask(cfg *configs.Config) *OperationMenuSubTask {
|
|
||||||
return &OperationMenuSubTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *OperationMenuSubTask) Execute() error {
|
|
||||||
subTaskItems := []common.Tasker{
|
|
||||||
NewTagOfficialImageSubTask(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 *OperationMenuSubTask) String() string {
|
|
||||||
return "edgestack"
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package edgestack
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
"ocl/portainer-devtool/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
type TagOfficialImageSubTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewTagOfficialImageSubTask(cfg *configs.Config) *TagOfficialImageSubTask {
|
|
||||||
return &TagOfficialImageSubTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *TagOfficialImageSubTask) Execute() error {
|
|
||||||
utils.SuccessPrint(`
|
|
||||||
docker pull nginx:latest
|
|
||||||
docker image tag nginx:latest ghcr.io/oscarzhou-portainer/nginx:1
|
|
||||||
docker push ghcr.io/oscarzhou-portainer/nginx:1
|
|
||||||
-----------------
|
|
||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
nginx-container:
|
|
||||||
image: ghcr.io/oscarzhou-portainer/nginx:1
|
|
||||||
container_name: "nginx-from-ghcr"
|
|
||||||
ports:
|
|
||||||
- "${PORT:-81}:80"
|
|
||||||
`)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *TagOfficialImageSubTask) String() string {
|
|
||||||
return "Create Image for Private Registry"
|
|
||||||
}
|
|
@ -19,8 +19,8 @@ func NewBuildDockerImageSubTask(cfg *configs.Config) *BuildDockerImageSubTask {
|
|||||||
func (task *BuildDockerImageSubTask) Execute() error {
|
func (task *BuildDockerImageSubTask) Execute() error {
|
||||||
utils.SuccessPrint(`
|
utils.SuccessPrint(`
|
||||||
yarn build
|
yarn build
|
||||||
docker build -t "portainerci/portainer-ee:4803" -f build/linux/Dockerfile .
|
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:ee-4803
|
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
|
return nil
|
||||||
|
@ -18,7 +18,6 @@ func NewMenuSubTask(cfg *configs.Config) *MenuSubTask {
|
|||||||
func (task *MenuSubTask) Execute() error {
|
func (task *MenuSubTask) Execute() error {
|
||||||
subTaskItems := []common.Tasker{
|
subTaskItems := []common.Tasker{
|
||||||
NewBuildDockerImageSubTask(task.Config),
|
NewBuildDockerImageSubTask(task.Config),
|
||||||
NewSwarmDeploySubTask(task.Config),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
common.ListCommandMenu(subTaskItems, "Which management commands do you want to choose:", false, task.ParentTasks)
|
common.ListCommandMenu(subTaskItems, "Which management commands do you want to choose:", false, task.ParentTasks)
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
package portaineree
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
"ocl/portainer-devtool/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
type SwarmDeploySubTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewSwarmDeploySubTask(cfg *configs.Config) *SwarmDeploySubTask {
|
|
||||||
return &SwarmDeploySubTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *SwarmDeploySubTask) Execute() error {
|
|
||||||
utils.SuccessPrint(`
|
|
||||||
version: '3.2'
|
|
||||||
|
|
||||||
services:
|
|
||||||
agent:
|
|
||||||
image: portainer/agent:latest
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
- /var/lib/docker/volumes:/var/lib/docker/volumes
|
|
||||||
networks:
|
|
||||||
- agent_network
|
|
||||||
deploy:
|
|
||||||
mode: global
|
|
||||||
placement:
|
|
||||||
constraints: [node.platform.os == linux]
|
|
||||||
|
|
||||||
portainer:
|
|
||||||
image: portainerci/portainer-ee:4803
|
|
||||||
command: -H tcp://tasks.agent:9001 --tlsskipverify --log-level ERROR
|
|
||||||
ports:
|
|
||||||
- "9443:9443"
|
|
||||||
- "9000:9000"
|
|
||||||
- "8000:8000"
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
- /home/oscar/volume/portainer-ee-data-1:/data
|
|
||||||
networks:
|
|
||||||
- agent_network
|
|
||||||
deploy:
|
|
||||||
mode: replicated
|
|
||||||
replicas: 1
|
|
||||||
placement:
|
|
||||||
constraints: [node.role == manager]
|
|
||||||
|
|
||||||
networks:
|
|
||||||
agent_network:
|
|
||||||
driver: overlay
|
|
||||||
attachable: true
|
|
||||||
--------------------------
|
|
||||||
docker stack deploy -c docker-compose.yaml portainer
|
|
||||||
`)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *SwarmDeploySubTask) String() string {
|
|
||||||
return "Build Docker Image"
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package tasks
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/configs"
|
|
||||||
"ocl/portainer-devtool/operations/edgestack"
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ListOperationMenuTask struct {
|
|
||||||
common.GeneralTask
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewListOperationMenuTask(cfg *configs.Config) *ListOperationMenuTask {
|
|
||||||
return &ListOperationMenuTask{
|
|
||||||
GeneralTask: *common.NewGeneralTask(cfg),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *ListOperationMenuTask) Execute() error {
|
|
||||||
subTaskItems := []common.Tasker{
|
|
||||||
edgestack.NewOperationMenuSubTask(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 *ListOperationMenuTask) String() string {
|
|
||||||
return "Choose Operations"
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package tasks
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ocl/portainer-devtool/tasks/common"
|
|
||||||
"ocl/portainer-devtool/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
type TestEnvironmentTask struct {
|
|
||||||
ParentTasks []common.Tasker
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewTestEnvironmentTask() *TestEnvironmentTask {
|
|
||||||
return &TestEnvironmentTask{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *TestEnvironmentTask) Execute() error {
|
|
||||||
utils.SuccessPrint(`
|
|
||||||
https://github.com/portainer/platform/actions
|
|
||||||
`)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *TestEnvironmentTask) SetParentTaskers(tasks []common.Tasker) {
|
|
||||||
task.ParentTasks = tasks
|
|
||||||
}
|
|
||||||
|
|
||||||
func (task *TestEnvironmentTask) String() string {
|
|
||||||
return "Create Testing Environment(VPN)"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user