Commit e80f8933 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '54610-allow-review-jobs-to-fail' into 'master'

Retry the review-{deploy,qa} jobs twice, and allow them to fail

Closes #54610 and #54717

See merge request gitlab-org/gitlab-ce!23510
parents 2e3cefa6 75ae3af1
...@@ -949,6 +949,8 @@ no_ee_check: ...@@ -949,6 +949,8 @@ no_ee_check:
# GitLab Review apps # GitLab Review apps
review-deploy: review-deploy:
<<: *review-base <<: *review-base
retry: 2
allow_failure: true
variables: variables:
GIT_DEPTH: "1" GIT_DEPTH: "1"
HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}" HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}"
...@@ -978,6 +980,8 @@ review-deploy: ...@@ -978,6 +980,8 @@ review-deploy:
.review-qa-base: &review-qa-base .review-qa-base: &review-qa-base
<<: *review-docker <<: *review-docker
retry: 2
allow_failure: true
variables: variables:
<<: *review-docker-variables <<: *review-docker-variables
API_TOKEN: "${GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN}" API_TOKEN: "${GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN}"
...@@ -1005,10 +1009,8 @@ review-deploy: ...@@ -1005,10 +1009,8 @@ review-deploy:
review-qa-smoke: review-qa-smoke:
<<: *review-qa-base <<: *review-qa-base
# retry: 2
script: script:
- gitlab-qa Test::Instance::Smoke "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}" - gitlab-qa Test::Instance::Smoke "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}"
allow_failure: true
review-qa-all: review-qa-all:
<<: *review-qa-base <<: *review-qa-base
......
puts "Creating the default ApplicationSetting record.".color(:green)
Gitlab::CurrentSettings.current_application_settings
...@@ -62,6 +62,41 @@ You can also manually start the `review-qa-all`: it runs the full QA suite. ...@@ -62,6 +62,41 @@ You can also manually start the `review-qa-all`: it runs the full QA suite.
Note that both jobs first wait for the `review-deploy` job to be finished. Note that both jobs first wait for the `review-deploy` job to be finished.
## How to?
### Find my Review App slug?
1. Open the `review-deploy` job.
1. Look for `Checking for previous deployment of review-*`.
1. For instance for `Checking for previous deployment of review-qa-raise-e-12chm0`,
your Review App slug would be `review-qa-raise-e-12chm0` in this case.
### Run a Rails console?
1. [Filter Workloads by your Review App slug](https://console.cloud.google.com/kubernetes/workload?project=gitlab-review-apps)
, e.g. `review-29951-issu-id2qax`.
1. Find and open the `task-runner` Deployment, e.g. `review-29951-issu-id2qax-task-runner`.
1. Click on the Pod in the "Managed pods" section, e.g. `review-29951-issu-id2qax-task-runner-d5455cc8-2lsvz`.
1. Click on the `KUBECTL` dropdown, then `Exec` -> `task-runner`.
1. Replace `-c task-runner -- ls` with `-- /srv/gitlab/bin/rails c` from the
default command or
- Run `kubectl exec --namespace review-apps-ce -it review-29951-issu-id2qax-task-runner-d5455cc8-2lsvz -- /srv/gitlab/bin/rails c`
and
- Replace `review-apps-ce` with `review-apps-ee` if the Review App
is running EE, and
- Replace `review-29951-issu-id2qax-task-runner-d5455cc8-2lsvz`
with your Pod's name.
### Dig into a Pod's logs?
1. [Filter Workloads by your Review App slug](https://console.cloud.google.com/kubernetes/workload?project=gitlab-review-apps)
, e.g. `review-1979-1-mul-dnvlhv`.
1. Find and open the `migrations` Deployment, e.g.
`review-1979-1-mul-dnvlhv-migrations.1`.
1. Click on the Pod in the "Managed pods" section, e.g.
`review-1979-1-mul-dnvlhv-migrations.1-nqwtx`.
1. Click on the `Container logs` link.
## Frequently Asked Questions ## Frequently Asked Questions
**Isn't it too much to trigger CNG image builds on every test run? This creates **Isn't it too much to trigger CNG image builds on every test run? This creates
......
...@@ -289,8 +289,8 @@ function get_job_id() { ...@@ -289,8 +289,8 @@ function get_job_id() {
local url="https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?per_page=100&page=${page}${query_string}" local url="https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?per_page=100&page=${page}${query_string}"
echoerr "GET ${url}" echoerr "GET ${url}"
local job_id=$(curl --silent --show-error --header "PRIVATE-TOKEN: ${API_TOKEN}" "${url}" | jq ".[] | select(.name == \"${job_name}\") | .id") local job_id=$(curl --silent --show-error --header "PRIVATE-TOKEN: ${API_TOKEN}" "${url}" | jq "map(select(.name == \"${job_name}\")) | map(.id) | last")
[[ "${job_id}" == "" && "${page}" -lt "$max_page" ]] || break [[ "${job_id}" == "null" && "${page}" -lt "$max_page" ]] || break
((page++)) ((page++))
done done
...@@ -328,17 +328,18 @@ function wait_for_job_to_be_done() { ...@@ -328,17 +328,18 @@ function wait_for_job_to_be_done() {
# In case the job hasn't finished yet. Keep trying until the job times out. # In case the job hasn't finished yet. Keep trying until the job times out.
local interval=30 local interval=30
local elapsed=0 local elapsed_seconds=0
while true; do while true; do
local job_status=$(curl --silent --show-error --header "PRIVATE-TOKEN: ${API_TOKEN}" "${url}" | jq ".status" | sed -e s/\"//g) local job_status=$(curl --silent --show-error --header "PRIVATE-TOKEN: ${API_TOKEN}" "${url}" | jq ".status" | sed -e s/\"//g)
[[ "${job_status}" == "pending" || "${job_status}" == "running" ]] || break [[ "${job_status}" == "pending" || "${job_status}" == "running" ]] || break
printf "." printf "."
((elapsed+=$interval)) ((elapsed_seconds+=$interval))
sleep ${interval} sleep ${interval}
done done
echoerr "Waited '${job_name}' for ${elapsed} seconds." local elapsed_minutes=$((elapsed_seconds / 60))
echoerr "Waited '${job_name}' for ${elapsed_minutes} minutes."
if [[ "${job_status}" == "failed" ]]; then if [[ "${job_status}" == "failed" ]]; then
echo "The '${job_name}' failed." echo "The '${job_name}' failed."
......
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