summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/services/system_note_service.rb4
-rw-r--r--app/services/system_notes/zoom_service.rb13
-rw-r--r--changelogs/unreleased/sh-github-import-handle-nil-dates.yml5
-rw-r--r--doc/ci/pipelines.md2
-rw-r--r--doc/development/internal_api.md11
-rw-r--r--lib/api/internal/base.rb16
-rw-r--r--lib/gitlab/github_import/importer/releases_importer.rb3
-rw-r--r--lib/gitlab/legacy_github_import/release_formatter.rb3
-rwxr-xr-xscripts/review_apps/review-apps.sh6
-rw-r--r--spec/lib/gitlab/github_import/importer/releases_importer_spec.rb16
-rw-r--r--spec/lib/gitlab/legacy_github_import/release_formatter_spec.rb8
-rw-r--r--spec/requests/api/internal/base_spec.rb55
-rw-r--r--spec/services/system_note_service_spec.rb24
-rw-r--r--spec/services/system_notes/zoom_service_spec.rb36
14 files changed, 99 insertions, 103 deletions
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 0399ce2e533..b3eee01ea7a 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -317,11 +317,11 @@ module SystemNoteService
end
def zoom_link_added(issue, project, author)
- create_note(NoteSummary.new(issue, project, author, _('added a Zoom call to this issue'), action: 'pinned_embed'))
+ ::SystemNotes::ZoomService.new(noteable: issue, project: project, author: author).zoom_link_added
end
def zoom_link_removed(issue, project, author)
- create_note(NoteSummary.new(issue, project, author, _('removed a Zoom call from this issue'), action: 'pinned_embed'))
+ ::SystemNotes::ZoomService.new(noteable: issue, project: project, author: author).zoom_link_removed
end
private
diff --git a/app/services/system_notes/zoom_service.rb b/app/services/system_notes/zoom_service.rb
new file mode 100644
index 00000000000..6cd166d6cb9
--- /dev/null
+++ b/app/services/system_notes/zoom_service.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module SystemNotes
+ class ZoomService < ::SystemNotes::BaseService
+ def zoom_link_added
+ create_note(NoteSummary.new(noteable, project, author, _('added a Zoom call to this issue'), action: 'pinned_embed'))
+ end
+
+ def zoom_link_removed
+ create_note(NoteSummary.new(noteable, project, author, _('removed a Zoom call from this issue'), action: 'pinned_embed'))
+ end
+ end
+end
diff --git a/changelogs/unreleased/sh-github-import-handle-nil-dates.yml b/changelogs/unreleased/sh-github-import-handle-nil-dates.yml
new file mode 100644
index 00000000000..d9b350a5197
--- /dev/null
+++ b/changelogs/unreleased/sh-github-import-handle-nil-dates.yml
@@ -0,0 +1,5 @@
+---
+title: 'GitHub import: Handle nil published_at dates'
+merge_request: 18355
+author:
+type: fixed
diff --git a/doc/ci/pipelines.md b/doc/ci/pipelines.md
index bb40feea10e..da67df3e774 100644
--- a/doc/ci/pipelines.md
+++ b/doc/ci/pipelines.md
@@ -379,6 +379,8 @@ This functionality is only available:
## Most Recent Pipeline
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/50499) in GitLab 12.3.
+
There's a link to the latest pipeline for the last commit of a given branch at `/project/pipelines/[branch]/latest`. Also, `/project/pipelines/latest` will redirect you to the latest pipeline for the last commit on the project's default branch.
## Security on protected branches
diff --git a/doc/development/internal_api.md b/doc/development/internal_api.md
index db61fca3939..2b8a20939ef 100644
--- a/doc/development/internal_api.md
+++ b/doc/development/internal_api.md
@@ -215,17 +215,6 @@ Example response:
- GitLab Geo
- GitLab-shell's `bin/check`
-## Broadcast message(s) [NOT USED]
-
-```
-GET /internal/broadcast_message
-GET /internal/broadcast_messages
-```
-
-**Deprecated:** This used to be used by GitLab-shell to print out broadcast
-messages. But this is now included in the `post_receive` call. Other
-clients can use the public BroadcastMessages API.
-
## Get new 2FA recovery codes using an SSH key
This is called from GitLab-shell and allows users to get new 2FA
diff --git a/lib/api/internal/base.rb b/lib/api/internal/base.rb
index 1fe884eea13..00e9b56b932 100644
--- a/lib/api/internal/base.rb
+++ b/lib/api/internal/base.rb
@@ -148,22 +148,6 @@ module API
}
end
- get "/broadcast_messages" do
- if messages = BroadcastMessage.current
- present messages, with: Entities::BroadcastMessage
- else
- []
- end
- end
-
- get "/broadcast_message" do
- if message = BroadcastMessage.current&.last
- present message, with: Entities::BroadcastMessage
- else
- {}
- end
- end
-
# rubocop: disable CodeReuse/ActiveRecord
post '/two_factor_recovery_codes' do
status 200
diff --git a/lib/gitlab/github_import/importer/releases_importer.rb b/lib/gitlab/github_import/importer/releases_importer.rb
index 1881f715c99..a3734ccf069 100644
--- a/lib/gitlab/github_import/importer/releases_importer.rb
+++ b/lib/gitlab/github_import/importer/releases_importer.rb
@@ -37,7 +37,8 @@ module Gitlab
description: description_for(release),
created_at: release.created_at,
updated_at: release.created_at,
- released_at: release.published_at,
+ # Draft releases will have a null published_at
+ released_at: release.published_at || Time.current,
project_id: project.id
}
end
diff --git a/lib/gitlab/legacy_github_import/release_formatter.rb b/lib/gitlab/legacy_github_import/release_formatter.rb
index fdab6b512ea..a083ae60726 100644
--- a/lib/gitlab/legacy_github_import/release_formatter.rb
+++ b/lib/gitlab/legacy_github_import/release_formatter.rb
@@ -10,7 +10,8 @@ module Gitlab
name: raw_data.name,
description: raw_data.body,
created_at: raw_data.created_at,
- released_at: raw_data.published_at,
+ # Draft releases will have a null published_at
+ released_at: raw_data.published_at || Time.current,
updated_at: raw_data.created_at
}
end
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh
index 4c44a32c7dd..51768d07860 100755
--- a/scripts/review_apps/review-apps.sh
+++ b/scripts/review_apps/review-apps.sh
@@ -255,9 +255,9 @@ EOF
}
function display_deployment_debug() {
- # Get all pods that are not ready (this will return completed pods for minio and migrations jobs)
- echoinfo "Unready Pods for release ${CI_ENVIRONMENT_SLUG}"
- kubectl get pods -n "$KUBE_NAMESPACE" -lrelease=${CI_ENVIRONMENT_SLUG} --field-selector=status.phase!=Running
+ # Get all pods for this release
+ echoinfo "Pods for release ${CI_ENVIRONMENT_SLUG}"
+ kubectl get pods -n "$KUBE_NAMESPACE" -lrelease=${CI_ENVIRONMENT_SLUG}
# Get all non-completed jobs
echoinfo "Unsuccessful Jobs for release ${CI_ENVIRONMENT_SLUG}"
diff --git a/spec/lib/gitlab/github_import/importer/releases_importer_spec.rb b/spec/lib/gitlab/github_import/importer/releases_importer_spec.rb
index a1585fd2eb3..6a31c57a73d 100644
--- a/spec/lib/gitlab/github_import/importer/releases_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/releases_importer_spec.rb
@@ -34,6 +34,22 @@ describe Gitlab::GithubImport::Importer::ReleasesImporter do
importer.execute
end
+
+ it 'imports draft releases' do
+ release_double = double(
+ name: 'Test',
+ body: 'This is description',
+ tag_name: '1.0',
+ description: 'This is my release',
+ created_at: created_at,
+ updated_at: created_at,
+ published_at: nil
+ )
+
+ expect(importer).to receive(:each_release).and_return([release_double])
+
+ expect { importer.execute }.to change { Release.count }.by(1)
+ end
end
describe '#build_releases' do
diff --git a/spec/lib/gitlab/legacy_github_import/release_formatter_spec.rb b/spec/lib/gitlab/legacy_github_import/release_formatter_spec.rb
index 2cf4b367c0b..554be57fbec 100644
--- a/spec/lib/gitlab/legacy_github_import/release_formatter_spec.rb
+++ b/spec/lib/gitlab/legacy_github_import/release_formatter_spec.rb
@@ -37,6 +37,14 @@ describe Gitlab::LegacyGithubImport::ReleaseFormatter do
expect(release.attributes).to eq(expected)
end
+
+ context 'with a nil published_at date' do
+ let(:published_at) { nil }
+
+ it 'inserts a timestamp for released_at' do
+ expect(release.attributes[:released_at]).to be_a(Time)
+ end
+ end
end
describe '#valid' do
diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb
index 7161d6f0a10..01a2e33c0d9 100644
--- a/spec/requests/api/internal/base_spec.rb
+++ b/spec/requests/api/internal/base_spec.rb
@@ -43,61 +43,6 @@ describe API::Internal::Base do
end
end
- describe 'GET /internal/broadcast_message' do
- context 'broadcast message exists' do
- let!(:broadcast_message) { create(:broadcast_message, starts_at: 1.day.ago, ends_at: 1.day.from_now ) }
-
- it 'returns one broadcast message' do
- get api('/internal/broadcast_message'), params: { secret_token: secret_token }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['message']).to eq(broadcast_message.message)
- end
- end
-
- context 'broadcast message does not exist' do
- it 'returns nothing' do
- get api('/internal/broadcast_message'), params: { secret_token: secret_token }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response).to be_empty
- end
- end
-
- context 'nil broadcast message' do
- it 'returns nothing' do
- allow(BroadcastMessage).to receive(:current).and_return(nil)
-
- get api('/internal/broadcast_message'), params: { secret_token: secret_token }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response).to be_empty
- end
- end
- end
-
- describe 'GET /internal/broadcast_messages' do
- context 'broadcast message(s) exist' do
- let!(:broadcast_message) { create(:broadcast_message, starts_at: 1.day.ago, ends_at: 1.day.from_now ) }
-
- it 'returns active broadcast message(s)' do
- get api('/internal/broadcast_messages'), params: { secret_token: secret_token }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response[0]['message']).to eq(broadcast_message.message)
- end
- end
-
- context 'broadcast message does not exist' do
- it 'returns nothing' do
- get api('/internal/broadcast_messages'), params: { secret_token: secret_token }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response).to be_empty
- end
- end
- end
-
describe 'GET /internal/two_factor_recovery_codes' do
it 'returns an error message when the key does not exist' do
post api('/internal/two_factor_recovery_codes'),
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb
index efc259babdc..83101add724 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -271,26 +271,22 @@ describe SystemNoteService do
end
describe '.zoom_link_added' do
- subject { described_class.zoom_link_added(issue, project, author) }
-
- it_behaves_like 'a system note' do
- let(:action) { 'pinned_embed' }
- end
+ it 'calls ZoomService' do
+ expect_next_instance_of(::SystemNotes::ZoomService) do |service|
+ expect(service).to receive(:zoom_link_added)
+ end
- it 'sets the zoom link added note text' do
- expect(subject.note).to eq('added a Zoom call to this issue')
+ described_class.zoom_link_added(noteable, project, author)
end
end
describe '.zoom_link_removed' do
- subject { described_class.zoom_link_removed(issue, project, author) }
-
- it_behaves_like 'a system note' do
- let(:action) { 'pinned_embed' }
- end
+ it 'calls ZoomService' do
+ expect_next_instance_of(::SystemNotes::ZoomService) do |service|
+ expect(service).to receive(:zoom_link_removed)
+ end
- it 'sets the zoom link removed note text' do
- expect(subject.note).to eq('removed a Zoom call from this issue')
+ described_class.zoom_link_removed(noteable, project, author)
end
end
diff --git a/spec/services/system_notes/zoom_service_spec.rb b/spec/services/system_notes/zoom_service_spec.rb
new file mode 100644
index 00000000000..435cdb5748e
--- /dev/null
+++ b/spec/services/system_notes/zoom_service_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ::SystemNotes::ZoomService do
+ let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:author) { create(:user) }
+
+ let(:noteable) { create(:issue, project: project) }
+
+ let(:service) { described_class.new(noteable: noteable, project: project, author: author) }
+
+ describe '#zoom_link_added' do
+ subject { service.zoom_link_added }
+
+ it_behaves_like 'a system note' do
+ let(:action) { 'pinned_embed' }
+ end
+
+ it 'sets the zoom link added note text' do
+ expect(subject.note).to eq('added a Zoom call to this issue')
+ end
+ end
+
+ describe '#zoom_link_removed' do
+ subject { service.zoom_link_removed }
+
+ it_behaves_like 'a system note' do
+ let(:action) { 'pinned_embed' }
+ end
+
+ it 'sets the zoom link removed note text' do
+ expect(subject.note).to eq('removed a Zoom call from this issue')
+ end
+ end
+end