Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/verify-pr-prefix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ jobs:
with:
fetch-depth: 0

- name: Dump commit message to file
run: |
git fetch origin ${{ github.event.pull_request.head.sha }}
git log -1 --pretty=format:"%B" ${{ github.event.pull_request.head.sha }} | head -n1 > commit-message-file

- name: Run commit message check
id: prefixcheck
run: |
./scripts/check-role-prefix.sh
./scripts/check-role-prefix.sh commit-message-file
1 change: 1 addition & 0 deletions roles/kustomize_deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ with a message.
Some tasks uses timeouts when applying or waiting for resources. Those timeouts can be controlled by:

* `cifmw_kustomize_deploy_delay`: (Int) Ansible `delay` passed to tasks that waits for a resource to reach a target state (default `10`)
* `cifmw_kustomize_deploy_retries_subscription`: (Int) Ansible `retries` passed to tasks that wait for the Subscription (default `90`)
* `cifmw_kustomize_deploy_retries_install_plan`: (Int) Ansible `retries` passed to tasks that wait for the InstallPlan (default `60`)

### Task tagging
Expand Down
1 change: 1 addition & 0 deletions roles/kustomize_deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ cifmw_kustomize_deploy_dp_dest_file: >-
# timeouts and retry configuration

cifmw_kustomize_deploy_delay: 10
cifmw_kustomize_deploy_retries_subscription: 90
cifmw_kustomize_deploy_retries_install_plan: 60

# Default retry settings for k8s_info operations to handle transient auth failures
Expand Down
24 changes: 12 additions & 12 deletions roles/kustomize_deploy/tasks/install_operators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
src: "{{ cifmw_kustomize_deploy_olm_dest_file }}"
register: _cifmw_kustomize_deploy_olm_apply_out

- name: Wait for the openstack operators InstallPlan to be created
- name: Wait for the openstack operators Subscription to be created
vars:
_cifmw_kustomize_deploy_olm_osp_operator_sub: >-
_cifmw_kustomize_deploy_olm_osp_operator_subscription: >-
{{
(
_cifmw_kustomize_deploy_olm_apply_out.result.results |
Expand All @@ -108,18 +108,18 @@
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
api_key: "{{ cifmw_openshift_token | default(omit) }}"
context: "{{ cifmw_openshift_context | default(omit) }}"
api_version: "{{ _cifmw_kustomize_deploy_olm_osp_operator_sub.apiVersion }}"
api_version: "{{ _cifmw_kustomize_deploy_olm_osp_operator_subscription.apiVersion }}"
kind: Subscription
namespace: "{{ _cifmw_kustomize_deploy_olm_osp_operator_sub.metadata.namespace }}"
name: "{{ _cifmw_kustomize_deploy_olm_osp_operator_sub.metadata.name }}"
register: _cifmw_kustomize_deploy_olm_osp_operator_sub_out
retries: "{{ cifmw_kustomize_deploy_retries_install_plan }}"
namespace: "{{ _cifmw_kustomize_deploy_olm_osp_operator_subscription.metadata.namespace }}"
name: "{{ _cifmw_kustomize_deploy_olm_osp_operator_subscription.metadata.name }}"
register: _cifmw_kustomize_deploy_olm_osp_operator_subscription_out
retries: "{{ cifmw_kustomize_deploy_retries_subscription }}"
delay: "{{ cifmw_kustomize_deploy_delay }}"
until:
- _cifmw_kustomize_deploy_olm_osp_operator_sub_out.failed is false
- _cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources is defined
- _cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | length == 1
- (_cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | first)['status']['installPlanRef'] is defined
- _cifmw_kustomize_deploy_olm_osp_operator_subscription_out.failed is false
- _cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources is defined
- _cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources | length == 1
- (_cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources | first)['status']['installPlanRef'] is defined

- name: Install plan
ansible.builtin.include_tasks: install_plan.yml
Expand All @@ -131,7 +131,7 @@
vars:
_install_plan: >-
{{
(_cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | first).status.installPlanRef
(_cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources | first).status.installPlanRef
}}
kubernetes.core.k8s_info:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
Expand Down
12 changes: 10 additions & 2 deletions scripts/check-role-prefix.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/bin/bash

# Get the latest commit message file
TMP_MSG_FILE=$(mktemp)
git log -1 --pretty=format:"%s%n%n%b" >"$TMP_MSG_FILE"
TMP_MSG_FILE="$1"

echo "Checking file $TMP_MSG_FILE"
cat $TMP_MSG_FILE

if [ -z "$TMP_MSG_FILE" ]; then
echo "now here"
TMP_MSG_FILE=$(mktemp)
git log -1 --pretty=format:"%B" | head -n1
fi

echo "Checking latest commit message:"
cat "$TMP_MSG_FILE"
Expand Down
2 changes: 1 addition & 1 deletion scripts/git-check-commit-body-length.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FAIL_LENGTH=0
FAIL_SIGNED_OFF_BY=0

BODY=$(tail -n +3 "$MSG_FILE" | sed '/^\s*#/d' | sed '/^\s*$/d')
BODY_LEN=$(echo -n "$BODY" | wc -m)
BODY_LEN=$(echo -n "$BODY" | sed '/Signed-off-by:/d' | wc -m)

if [ "$BODY_LEN" -lt "$MIN_BODY_LEN" ]; then
echo -e "\n\n**WARNING: Commit message body is too short (has $BODY_LEN chars, minimum $MIN_BODY_LEN required).**\n" >&2
Expand Down
Loading