Skip to content

some changes #13

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
56 changes: 32 additions & 24 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@

[[constraint]]
name = "github.com/mattn/go-runewidth"
version = "0.0.3"
version = "0.0.4"

[[constraint]]
name = "github.com/spf13/cobra"
version = "0.0.3"
version = "0.0.4"

[[constraint]]
name = "gopkg.in/yaml.v2"
version = "2.2.1"

[[constraint]]
branch = "master"
name = "github.com/lastbackend/lastbackend"
branch = "master"

[[constraint]]
branch = "master"
name = "github.com/howeyc/gopass"

[[constraint]]
name = "gopkg.in/yaml.v3"
branch = "v3"

[prune]
go-tests = true
unused-packages = true
53 changes: 27 additions & 26 deletions contrib/examples/job-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ version: v1
meta:
name: build
labels:
app: lastbackend
type: job
app: lastbackend
spec:
enabled: true
concurrency:
Expand All @@ -15,37 +15,38 @@ spec:
endpoint: "http://127.0.0.1:2965/task/manifest"
method: GET
headers:
X-LASTBACKEND-AUTH: "lstbknd"
X-LASTBACKEND-AUTH: "11c9ae503b8a46c6abba315c3f5e07db"
hook:
http:
endpoint: "http://127.0.0.1:2965/task/status"
method: PUT
headers:
X-LASTBACKEND-AUTH: "lstbknd"
X-LASTBACKEND-AUTH: "11c9ae503b8a46c6abba315c3f5e07db"
task:
runtime:
services: [dind]
# services: [dind]
services: []
tasks:
- name: "build"
container: "git"
commands:
- command: "docker build -t index.lstbknd.net/undassa/alpine github.com/undassa/alpine"
- name: "push"
container: "git"
commands:
- command: "docker push index.lstbknd.net/undassa/alpine"
# - name: "build"
# container: "git"
# commands:
# - command: "docker build -t index.lstbknd.net/undassa/alpine github.com/undassa/alpine"
# - name: "push"
# container: "git"
# commands:
# - command: "docker push index.lstbknd.net/undassa/alpine"
template:
containers:
- name: dind
image:
name: docker:18.09.1-dind
restart:
policy: always
security:
privileged: true
- name: git
image:
name: docker:18.09.1-git
env:
- name: DOCKER_HOST
value: "tcp://127.0.0.1:2375"
# containers:
# - name: dind
# image:
# name: docker:18.09.1-dind
# restart:
# policy: always
# security:
# privileged: true
# - name: git
# image:
# name: docker:18.09.1-git
# env:
# - name: DOCKER_HOST
# value: "tcp://127.0.0.1:2375"
5 changes: 1 addition & 4 deletions hack/build-cross.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#!/bin/bash

go get -u github.com/golang/dep/cmd/dep
dep ensure

mkdir -p build/linux && mkdir -p build/darwin

## declare an array of components variable
declare -a arr=("kit" "node" "cli")
declare -a arr=("cli")

if [[ $1 != "" ]]; then
arr=($1)
Expand Down
3 changes: 1 addition & 2 deletions pkg/cli/cmd/cluster_del.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ var ClusterDelCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
name := args[0]

err := storage.DelLocalCluster(name)
if err != nil {
if err := storage.DelLocalCluster(name); err != nil {
panic(err)
}

Expand Down
1 change: 1 addition & 0 deletions pkg/cli/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ var RootCmd = &cobra.Command{
return
}
host = cluster.Endpoint
config.Token = cluster.Token
case "r.":
config.Headers = make(map[string]string, 0)
config.Headers["X-Cluster-Name"] = cluster[2:]
Expand Down
20 changes: 18 additions & 2 deletions pkg/cli/cmd/job_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ import (
)

func init() {
jobLogsCmd.Flags().StringP("task", "t", "", "read logs for particular task")
jobLogsCmd.Flags().IntP("tail", "t", 0, "tail last n lines")
jobLogsCmd.Flags().BoolP("follow", "f", false, "follow logs")
jobLogsCmd.Flags().String("task", "", "read logs for particular task")
jobCmd.AddCommand(jobLogsCmd)
}

Expand All @@ -58,6 +60,18 @@ var jobLogsCmd = &cobra.Command{
return
}

opts.Tail, err = cmd.Flags().GetInt("tail")
if err != nil {
fmt.Println(err.Error())
return
}

opts.Follow, err = cmd.Flags().GetBool("follow")
if err != nil {
fmt.Println(err.Error())
return
}

if task != types.EmptyString {
opts.Task = task
}
Expand All @@ -84,7 +98,9 @@ var jobLogsCmd = &cobra.Command{
os.Exit(1)
}

fmt.Println(">", doc.Selflink, doc.Data)
if doc.ContainerType == types.ContainerTypeRuntimeTask {
fmt.Println(doc.Data)
}
}
},
}
2 changes: 1 addition & 1 deletion pkg/cli/cmd/namespace_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/lastbackend/lastbackend/pkg/api/types/v1"
"github.com/lastbackend/lastbackend/pkg/api/types/v1/request"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
)

const applyExample = `
Expand Down
16 changes: 16 additions & 0 deletions pkg/cli/cmd/service_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
)

func init() {
serviceLogsCmd.Flags().IntP("tail", "t", 0, "tail last n lines")
serviceLogsCmd.Flags().BoolP("follow", "f", false, "follow logs")
serviceCmd.AddCommand(serviceLogsCmd)
}

Expand All @@ -47,6 +49,20 @@ var serviceLogsCmd = &cobra.Command{

opts := new(request.ServiceLogsOptions)

var err error

opts.Tail, err = cmd.Flags().GetInt("tail")
if err != nil {
fmt.Println(err.Error())
return
}

opts.Follow, err = cmd.Flags().GetBool("follow")
if err != nil {
fmt.Println(err.Error())
return
}

namespace, name, err := serviceParseSelfLink(args[0])
checkError(err)

Expand Down
Loading