semaph 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +12 -8
- data/lib/semaph/formatting.rb +1 -1
- data/lib/semaph/model/workflow.rb +3 -2
- data/lib/semaph/shells/organisation/organisation_shell.rb +2 -2
- data/lib/semaph/shells/organisations/organisations_shell.rb +2 -2
- data/lib/semaph/shells/pipeline/job_log_grep_command.rb +4 -3
- data/lib/semaph/shells/pipeline/pipeline_shell.rb +3 -2
- data/lib/semaph/shells/project/project_shell.rb +2 -2
- data/lib/semaph/shells/project/workflows_list_command.rb +4 -6
- data/lib/semaph/shells/workflow/workflow_shell.rb +2 -2
- data/lib/semaph/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f87c47f0c0284d850593103961da8d6a7dc749042dc774aaa8f16f59f4fa183
|
4
|
+
data.tar.gz: 4c35a0cdfec02111a076738d6be9e2b18f1bd2a598bb3020f859840a21613556
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 348e0df084693205e3d59a18e886674d5783cf451b362d1dbf6aa0e5acd6dcaa5715313339e3c81c7a1dffb5f590a093684f99cc668c33dbc983182abce9d4bf
|
7
|
+
data.tar.gz: a3c64e20563744c6224b0cbd7deac2fa50a8c3d0c53eceda20c8f8d9d294cb25e8307f489d0ebebfe582c1d1fad5eb25d88e897fd5ecb4e91b294eaa76200a46
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -60,8 +60,6 @@ If you have only one set of credentials in `~/.sem.yml` then this will be the in
|
|
60
60
|
|
61
61
|
From here you can `list-projects` and then `select-project` to enter a shell for that project.
|
62
62
|
|
63
|
-
If new projects have been added/removed while you are using this shell, you can `reload-projects`.
|
64
|
-
|
65
63
|
### project shell
|
66
64
|
|
67
65
|
🏗 foo.semaphoreci.com my-app >
|
@@ -71,8 +69,8 @@ substring of the git branch you want to see workflows for) and then `select-work
|
|
71
69
|
(where 'index' is the number displayed for each workflow `list-workflows` - tab completion on uuids
|
72
70
|
seemed a bad idea) to enter a shell for that specific workflow.
|
73
71
|
|
74
|
-
You can also `open-github` (opens a web browser for the github project associated with the project)
|
75
|
-
(opens the semaphoreci project in a browser)
|
72
|
+
You can also `open-github` (opens a web browser for the github project associated with the project) and `open-project`
|
73
|
+
(opens the semaphoreci project in a browser).
|
76
74
|
|
77
75
|
### workflow shell
|
78
76
|
|
@@ -83,16 +81,22 @@ from `semaphore.yml` plus any promotion pipelines that might be executed. You c
|
|
83
81
|
what's happening with the pipeline.
|
84
82
|
|
85
83
|
You can also `open-github-branch`, `open-github-commit` to see the branch/commit in a browser and
|
86
|
-
`open-workflow`, `open-branch` to see the semaphore branch/workflow in a browser
|
87
|
-
any changes that have happened in semaphore.
|
84
|
+
`open-workflow`, `open-branch` to see the semaphore branch/workflow in a browser.
|
88
85
|
|
89
86
|
### pipeline shell
|
90
87
|
|
91
88
|
🏗 foo.semaphoreci.com my-app workflowuuid semaphore.yml >
|
92
89
|
|
93
|
-
From this shell, you can `list-jobs` and `
|
90
|
+
From this shell, you can `list-jobs`, `poll-jobs`, `job-log` and `grep-logs`.
|
91
|
+
|
92
|
+
Job polling will stop as soon as any one job has failed and send a system notification
|
93
|
+
(as long as `terminal-notifier` is installed).
|
94
|
+
|
95
|
+
You can look at the log for a specific job (by the index presented in `list-jobs`) using `less`.
|
96
|
+
|
97
|
+
You can grep across all jobs (using `ag`) with `grep-logs` which will download the logs for all completed jobs.
|
94
98
|
|
95
|
-
|
99
|
+
You can also open the same browser views in semaphoreci and github from this shell.
|
96
100
|
|
97
101
|
## Development
|
98
102
|
|
data/lib/semaph/formatting.rb
CHANGED
@@ -3,17 +3,18 @@ require "semaph/model/pipeline_collection"
|
|
3
3
|
module Semaph
|
4
4
|
module Model
|
5
5
|
class Workflow
|
6
|
-
attr_reader :project, :raw, :id, :sha, :branch, :branch_id, :created_at
|
6
|
+
attr_reader :project, :raw, :id, :sha, :commit, :branch, :branch_id, :created_at
|
7
7
|
|
8
8
|
def initialize(project, raw)
|
9
9
|
@project = project
|
10
10
|
@raw = raw
|
11
11
|
@id = raw["wf_id"]
|
12
12
|
@sha = raw["commit_sha"]
|
13
|
+
@commit = @sha.slice(0..10)
|
13
14
|
@created_at = Time.at(raw["created_at"]["seconds"].to_i)
|
14
15
|
@branch = raw["branch_name"]
|
15
16
|
@branch_id = raw["branch_id"]
|
16
|
-
|
17
|
+
@commit = `git log -n 1 --format="%h %an %s" #{sha}`.chomp if `git cat-file -t #{sha} 2>&1`.chomp == "commit"
|
17
18
|
end
|
18
19
|
|
19
20
|
def pipeline_collection
|
@@ -23,8 +23,8 @@ module Semaph
|
|
23
23
|
def add_commands
|
24
24
|
project_collection = ::Semaph::Model::ProjectCollection.new(@client)
|
25
25
|
@project_list_command = ProjectsListCommand.new(project_collection)
|
26
|
-
add_command @project_list_command, "list-projects"
|
27
|
-
add_command ProjectsSelectCommand.new(project_collection), "select-project"
|
26
|
+
add_command @project_list_command, "list-projects", "ls"
|
27
|
+
add_command ProjectsSelectCommand.new(project_collection), "select-project", "cd"
|
28
28
|
add_command ::Semaph::Commands::ReloadCommand.new, "reload" if ENV["SEMAPH_RELOAD"]
|
29
29
|
end
|
30
30
|
end
|
@@ -13,8 +13,8 @@ module Semaph
|
|
13
13
|
@organisations = organisations
|
14
14
|
@prompt = "🏗 > "
|
15
15
|
organisations_list_command = OrganisationsListCommand.new(organisations)
|
16
|
-
add_command organisations_list_command, "list-organisations"
|
17
|
-
add_command OrganisationsSelectCommand.new(organisations), "select-organisation"
|
16
|
+
add_command organisations_list_command, "list-organisations", "ls"
|
17
|
+
add_command OrganisationsSelectCommand.new(organisations), "select-organisation", "cd"
|
18
18
|
add_command ::Semaph::Commands::ReloadCommand.new, "reload" if ENV["SEMAPH_RELOAD"]
|
19
19
|
organisations_list_command.execute("")
|
20
20
|
end
|
@@ -6,16 +6,17 @@ module Semaph
|
|
6
6
|
class JobLogGrepCommand
|
7
7
|
attr_reader :usage, :help, :job_collection
|
8
8
|
|
9
|
-
def initialize(job_collection)
|
9
|
+
def initialize(job_collection, scope)
|
10
10
|
@job_collection = job_collection
|
11
|
+
@scope = scope
|
11
12
|
@usage = "<expression>"
|
12
|
-
@help = "retrieve
|
13
|
+
@help = "retrieve logs for #{scope} jobs and grep for text"
|
13
14
|
end
|
14
15
|
|
15
16
|
def execute(expression)
|
16
17
|
base = "tmp/logs/pipeline/#{job_collection.pipeline.id}"
|
17
18
|
FileUtils.mkdir_p(base)
|
18
|
-
@job_collection.
|
19
|
+
@job_collection.send(@scope).each do |job|
|
19
20
|
unless job.finished?
|
20
21
|
puts "skipping incomplete job #{job.id}"
|
21
22
|
next
|
@@ -37,10 +37,11 @@ module Semaph
|
|
37
37
|
|
38
38
|
def add_commands
|
39
39
|
@jobs_list_command = JobsListCommand.new(job_collection)
|
40
|
-
add_command @jobs_list_command, "list-jobs"
|
40
|
+
add_command @jobs_list_command, "list-jobs", "ls"
|
41
41
|
add_command JobsPollCommand.new(job_collection), "poll-jobs"
|
42
42
|
add_command JobLogCommand.new(job_collection), "job-log"
|
43
|
-
add_command JobLogGrepCommand.new(job_collection), "grep-logs"
|
43
|
+
add_command JobLogGrepCommand.new(job_collection, :all), "grep-all-logs"
|
44
|
+
add_command JobLogGrepCommand.new(job_collection, :failed), "grep-failed-logs"
|
44
45
|
add_command ::Semaph::Commands::RerunWorkflowCommand.new(workflow), "rerun"
|
45
46
|
add_open_branch_command
|
46
47
|
add_open_workflow_command
|
@@ -29,8 +29,8 @@ module Semaph
|
|
29
29
|
add_github_command
|
30
30
|
add_open_project_command
|
31
31
|
@workflows_list_command = WorkflowsListCommand.new(workflow_collection)
|
32
|
-
add_command @workflows_list_command, "list-workflows"
|
33
|
-
add_command WorkflowsSelectCommand.new(workflow_collection), "select-workflow"
|
32
|
+
add_command @workflows_list_command, "list-workflows", "ls"
|
33
|
+
add_command WorkflowsSelectCommand.new(workflow_collection), "select-workflow", "cd"
|
34
34
|
add_command ::Semaph::Commands::ReloadCommand.new, "reload" if ENV["SEMAPH_RELOAD"]
|
35
35
|
end
|
36
36
|
|
@@ -1,9 +1,9 @@
|
|
1
|
+
require "semaph/formatting"
|
2
|
+
|
1
3
|
module Semaph
|
2
4
|
module Shells
|
3
5
|
module Project
|
4
6
|
class WorkflowsListCommand
|
5
|
-
TIME_FORMAT = "%Y-%m-%d %H:%M:%S".freeze
|
6
|
-
|
7
7
|
attr_reader :usage, :help
|
8
8
|
|
9
9
|
def initialize(workflow_collection)
|
@@ -26,11 +26,9 @@ module Semaph
|
|
26
26
|
def description(index, workflow)
|
27
27
|
[
|
28
28
|
index + 1,
|
29
|
-
workflow.created_at
|
30
|
-
"SHA",
|
31
|
-
workflow.sha,
|
32
|
-
"on branch",
|
29
|
+
Semaph::Formatting.time(workflow.created_at),
|
33
30
|
workflow.branch,
|
31
|
+
workflow.commit,
|
34
32
|
].join(" ")
|
35
33
|
end
|
36
34
|
end
|
@@ -33,8 +33,8 @@ module Semaph
|
|
33
33
|
|
34
34
|
def add_commands
|
35
35
|
@list_command = PipelinesListCommand.new(pipeline_collection)
|
36
|
-
add_command @list_command, "list-pipelines"
|
37
|
-
add_command PipelinesSelectCommand.new(pipeline_collection), "select-pipeline"
|
36
|
+
add_command @list_command, "list-pipelines", "ls"
|
37
|
+
add_command PipelinesSelectCommand.new(pipeline_collection), "select-pipeline", "cd"
|
38
38
|
add_command ::Semaph::Commands::RerunWorkflowCommand.new(workflow), "rerun"
|
39
39
|
add_command ::Semaph::Commands::StopWorkflowCommand.new(workflow), "stop"
|
40
40
|
add_open_branch_command
|
data/lib/semaph/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semaph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Ryall
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|