Commit ec9be16d authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-10-31

# Conflicts:
#	lib/banzai/issuable_extractor.rb

[ci skip]
parents 2accb0d3 5e65d498
......@@ -875,7 +875,10 @@ gitlab:setup-mysql:
# Frontend-related jobs
gitlab:assets:compile:
<<: *dedicated-no-docs-and-no-qa-pull-cache-job
image: dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.4.4-git-2.18-chrome-69.0-node-8.x-yarn-1.2-graphicsmagick-1.3.29-docker-18.06.1
dependencies: []
services:
- docker:stable-dind
variables:
NODE_ENV: "production"
RAILS_ENV: "production"
......@@ -884,18 +887,23 @@ gitlab:assets:compile:
WEBPACK_REPORT: "true"
# we override the max_old_space_size to prevent OOM errors
NODE_OPTIONS: --max_old_space_size=3584
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
script:
- date
- yarn install --frozen-lockfile --production --cache-folder .yarn-cache
- date
- free -m
- bundle exec rake gitlab:assets:compile
- scripts/build_assets_image
artifacts:
name: webpack-report
expire_in: 31d
paths:
- webpack-report/
- public/assets/
tags:
- docker
karma:
<<: *dedicated-no-docs-pull-cache-job
......
# Simple container to store assets for later use
FROM scratch
ADD public/assets /assets/
CMD /bin/true
......@@ -9,7 +9,7 @@ class JobEntity < Grape::Entity
expose :started?, as: :started
expose :build_path do |build|
build.target_url || path_to(:namespace_project_job, build)
build_path(build)
end
expose :retry_path, if: -> (*) { retryable? } do |build|
......@@ -17,7 +17,11 @@ class JobEntity < Grape::Entity
end
expose :cancel_path, if: -> (*) { cancelable? } do |build|
path_to(:cancel_namespace_project_job, build)
path_to(
:cancel_namespace_project_job,
build,
{ continue: { to: build_path(build) } }
)
end
expose :play_path, if: -> (*) { playable? } do |build|
......@@ -60,8 +64,12 @@ class JobEntity < Grape::Entity
build.detailed_status(request.current_user)
end
def path_to(route, build)
send("#{route}_path", build.project.namespace, build.project, build) # rubocop:disable GitlabSecurity/PublicSend
def path_to(route, build, params = {})
send("#{route}_path", build.project.namespace, build.project, build, params) # rubocop:disable GitlabSecurity/PublicSend
end
def build_path(build)
build.target_url || path_to(:namespace_project_job, build)
end
def failed?
......
......@@ -9,8 +9,11 @@ module Banzai
# so we can avoid N+1 queries problem
class IssuableExtractor
<<<<<<< HEAD
prepend EE::Banzai::IssuableExtractor
=======
>>>>>>> upstream/master
attr_reader :context
ISSUE_REFERENCE_TYPE = '@data-reference-type="issue"'.freeze
......@@ -33,6 +36,7 @@ module Banzai
end
private
<<<<<<< HEAD
def issuables_for_nodes(nodes)
parsers.each_with_object({}) do |parser, result|
......@@ -40,6 +44,15 @@ module Banzai
end
end
=======
def issuables_for_nodes(nodes)
parsers.each_with_object({}) do |parser, result|
result.merge!(parser.records_for_nodes(nodes))
end
end
>>>>>>> upstream/master
def parsers
[
Banzai::ReferenceParser::IssueParser.new(context),
......
#!/bin/bash
# Generate the image name based on the project this is being run in
ASSETS_IMAGE_NAME=$(echo ${CI_PROJECT_NAME} |
awk '{
split($1, p, "-");
interim = sprintf("%s-assets-%s", p[1], p[2]);
sub(/-$/, "", interim);
print interim
}'
)
ASSETS_IMAGE_PATH=${CI_REGISTRY}/${CI_PROJECT_PATH}/${ASSETS_IMAGE_NAME}
mkdir -p assets_container.build/public
cp -r public/assets assets_container.build/public/
cp Dockerfile.assets assets_container.build/
docker build -t ${ASSETS_IMAGE_PATH}:${CI_COMMIT_REF_NAME} -f assets_container.build/Dockerfile.assets assets_container.build/
docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
docker push ${ASSETS_IMAGE_PATH}
......@@ -152,11 +152,33 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('job/job_details')
expect(json_response['raw_path']).to match(%r{jobs/\d+/raw\z})
expect(json_response.dig('merge_request', 'path')).to match(%r{merge_requests/\d+\z})
expect(json_response['merge_request']['path']).to match(%r{merge_requests/\d+\z})
expect(json_response['new_issue_path']).to include('/issues/new')
end
end
context 'when job is running' do
context 'job is cancelable' do
let(:job) { create(:ci_build, :running, pipeline: pipeline) }
it 'cancel_path is present with correct redirect' do
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('job/job_details')
expect(json_response['cancel_path']).to include(CGI.escape(json_response['build_path']))
end
end
context 'with web terminal' do
let(:job) { create(:ci_build, :running, :with_runner_session, pipeline: pipeline) }
it 'exposes the terminal path' do
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('job/job_details')
expect(json_response['terminal_path']).to match(%r{/terminal})
end
end
end
context 'when job has artifacts' do
context 'with not expiry date' do
let(:job) { create(:ci_build, :success, :artifacts, pipeline: pipeline) }
......@@ -185,16 +207,6 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
end
context 'when job has terminal' do
let(:job) { create(:ci_build, :running, :with_runner_session, pipeline: pipeline) }
it 'exposes the terminal path' do
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('job/job_details')
expect(json_response['terminal_path']).to match(%r{/terminal})
end
end
context 'when job passed with no trace' do
let(:job) { create(:ci_build, :success, :artifacts, pipeline: pipeline) }
......
......@@ -198,6 +198,24 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
end
end
context 'when job is running', :js do
let(:job) { create(:ci_build, :running, pipeline: pipeline) }
let(:job_url) { project_job_path(project, job) }
before do
visit job_url
wait_for_requests
end
context 'job is cancelable' do
it 'shows cancel button' do
click_link 'Cancel'
expect(page.current_path).to eq(job_url)
end
end
end
context "Job from other project" do
before do
visit project_job_path(project, job2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment