afterlife 1.9.0 → 1.9.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ded787195d0197794e9ce63aab421fd0b9f4168208bab96b1cdab4e34f22d955
4
- data.tar.gz: f9305bba34772dbe134eedad518d67ad371e85a1e8b6f28b25785f54f8737e58
3
+ metadata.gz: d237f1804b7bd717dd3fb578ed2e7d9a820b43a8fb47098edb373e104e4e8cd3
4
+ data.tar.gz: 1cb0443f7297dd8ebc9cf9524f39364a9f855e4d9b35b8f47d1a0226995e90f2
5
5
  SHA512:
6
- metadata.gz: decbc189d4fc9e422ab524fdd80adc4234d919542350db532bc04a69a48cdef40220fde5331fb94fa77c1427a59df5d4328f7d454e50d8a8b20d336c239e976b
7
- data.tar.gz: 394711b68721f95e338b558c51d86581537b6a0ddf7f4dcd31646420cf0a9cebcdfbff60ef2395f4b13acaae1e44856aac5b57b0d690402f46c51b8053a94d81
6
+ metadata.gz: 728bf6700229c7bbdb11415a83bc277ee4363f5079e8b160de63a80c9a95c35f1729fb640d2c7a86cc1a7cd13365c688afc7ca0458535ec780dbd2769986e06e
7
+ data.tar.gz: 482cdf49525924556b0b04bb32903e64af39c408e7dbccdb05d5af5891d4e9eaa2c8887ae341c53bf360ec13bd336f5447b2f1d9205b99c3597d2ee755324c45
data/lib/afterlife/cli.rb CHANGED
@@ -34,6 +34,7 @@ module Afterlife
34
34
  option 'no-install', type: :boolean
35
35
  option 'no-auth', type: :boolean
36
36
  option 'no-apply', type: :boolean
37
+ option 'no-latest', type: :boolean
37
38
  option 'dry-run', type: :boolean
38
39
  option 'skip-after-hooks', type: :boolean
39
40
  option :yes, type: :boolean
@@ -6,7 +6,7 @@ module Afterlife
6
6
  module Clickup
7
7
  class Api
8
8
  BASE_URL = 'https://api.clickup.com'
9
- attr_reader :connection
9
+ attr_reader :connection, :last_update_error
10
10
 
11
11
  def initialize(token:)
12
12
  @connection = Faraday.new(
@@ -26,8 +26,10 @@ module Afterlife
26
26
  end
27
27
 
28
28
  def update_task(task_id, params)
29
+ @last_update_error = nil
29
30
  connection.put("/api/v2/task/#{task_id}", params).body
30
31
  rescue Faraday::Error => e
32
+ @last_update_error = e.message
31
33
  puts "Error updating task #{task_id}: #{e.message}"
32
34
  nil
33
35
  end
@@ -8,6 +8,8 @@ module Afterlife
8
8
  /#CU_([a-z0-9]+)/i,
9
9
  /#([a-z0-9]{8,})/i,
10
10
  /CU-([a-z0-9]+)/i,
11
+ /\bClickUp task\s+((?=[a-z0-9]*\d)[a-z0-9]{8,})\b/i,
12
+ %r{\bhttps://app\.clickup\.com/t/(?:\d+/)?((?=[a-z0-9]*\d)[a-z0-9]{8,})\b}i,
11
13
  ].freeze
12
14
 
13
15
  def self.call(text, convert_to_link = false)
@@ -23,6 +23,8 @@ module Afterlife
23
23
 
24
24
  def revert_count(line, task_id)
25
25
  before_task_id = line.split(/#?(?:CU[-_])?#{Regexp.escape(task_id)}/i, 2).first
26
+ return 0 unless line[before_task_id.length..].include?('"')
27
+
26
28
  before_task_id.scan(/\brevert\b/i).count
27
29
  end
28
30
  end
@@ -24,10 +24,8 @@ module Afterlife
24
24
  end
25
25
 
26
26
  def call(task_ids, target_status) # rubocop:disable Metrics/AbcSize
27
- if task_ids.empty?
28
- log 'No tasks to update'
29
- return []
30
- end
27
+ @skipped_tasks = []
28
+ log 'No tasks to update' if task_ids.empty?
31
29
 
32
30
  log 'WARNING: Forcing status updates...' if force
33
31
  log 'WARNING: Dry run, no tasks will be updated' if dry_run
@@ -38,6 +36,9 @@ module Afterlife
38
36
  cherry_pick_status = " - Cherry Pick: #{task[:is_cherry_pick] ? '✅' : '❌'}" if cherry_pick
39
37
  log "- #{task[:link]} (from '#{task[:previous_status]}' to '#{task[:new_status]}')#{cherry_pick_status}"
40
38
  end
39
+ summary = "#{dry_run ? 'Would move' : 'Moved'} #{moved_task_ids.length}; skipped #{@skipped_tasks.length}"
40
+ summary += ": #{@skipped_tasks.join(', ')}" unless @skipped_tasks.empty?
41
+ log summary
41
42
  moved_task_ids
42
43
  end
43
44
 
@@ -47,8 +48,8 @@ module Afterlife
47
48
  task = api.get_task(task_id)
48
49
  current_status = task&.dig('status', 'status')&.downcase
49
50
  if current_status.nil?
50
- log "WARNING: Task #{task_id} not found", verbose: true
51
- return
51
+ reason = task.nil? ? 'task not found' : 'no status'
52
+ return skip_task(task_id, current_status, target_status, reason)
52
53
  end
53
54
 
54
55
  is_cherry_pick = Array(task['custom_fields']).any? do |field|
@@ -59,7 +60,9 @@ module Afterlife
59
60
  next_status = next_status_for(task_id, task, target_status)
60
61
  return if next_status.nil?
61
62
 
62
- api.update_task(task_id, { status: next_status }) unless dry_run
63
+ unless dry_run || api.update_task(task_id, { status: next_status })
64
+ return skip_task(task_id, current_status, next_status, "update failed: #{api.last_update_error}")
65
+ end
63
66
 
64
67
  {
65
68
  id: task_id,
@@ -75,18 +78,24 @@ module Afterlife
75
78
  reverted = revert_detector.reverted?(task_id)
76
79
  next_status = NextTaskStatusDecider.call(clickup_task: task, target_status:, force:, reverted:)
77
80
 
78
- if reverted && next_status
79
- log "Moving task https://app.clickup.com/t/#{task_id} to '#{next_status}': reverted in pushed commits"
80
- elsif !reverted && next_status.nil?
81
- log(
82
- "Skipping task https://app.clickup.com/t/#{task_id} because it's already at '#{current_status}'",
83
- verbose: true,
84
- )
81
+ if reverted && current_status == NextTaskStatusDecider::REVERT_SOURCE_STATUS && next_status
82
+ action = dry_run ? 'Would move' : 'Moving'
83
+ log "#{action} task https://app.clickup.com/t/#{task_id} to '#{next_status}': reverted in pushed commits"
84
+ elsif next_status.nil?
85
+ reason = reverted ? 'revert policy' : 'already at/after target'
86
+ return skip_task(task_id, current_status, target_status, reason)
85
87
  end
86
88
 
87
89
  next_status
88
90
  end
89
91
 
92
+ def skip_task(task_id, current_status, target_status, reason)
93
+ log "Skipping task https://app.clickup.com/t/#{task_id} " \
94
+ "(from '#{current_status || 'unknown'}' to '#{target_status}'): #{reason}"
95
+ @skipped_tasks << "#{task_id} (#{reason})"
96
+ nil
97
+ end
98
+
90
99
  def log(message, verbose: false)
91
100
  return if verbose && !@verbose
92
101
 
@@ -19,6 +19,7 @@ module Afterlife
19
19
  authenticate_command,
20
20
  # from DockerDeployment
21
21
  build_command,
22
+ set_latest_image_command,
22
23
  set_image_command,
23
24
  apply_kubernetes_settings,
24
25
  ].flatten.compact
@@ -41,6 +42,16 @@ module Afterlife
41
42
  "#{registry}/#{full_image_name(target)}:#{repo.current_revision}"
42
43
  end
43
44
 
45
+ def set_latest_image_command
46
+ return unless Afterlife.current_stage.name.to_sym == :qa
47
+ return if options['no-latest']
48
+
49
+ targets.map do |target|
50
+ image = "#{registry}/#{full_image_name(target)}"
51
+ "docker buildx imagetools create --tag #{image}:latest #{image}:#{repo.current_revision}"
52
+ end
53
+ end
54
+
44
55
  def full_image_name(target)
45
56
  return image_name if target == 'app'
46
57
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Afterlife
4
- VERSION = '1.9.0'
4
+ VERSION = '1.9.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: afterlife
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genaro Madrid
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-03 00:00:00.000000000 Z
11
+ date: 2026-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday