Skip to content

Commit

Permalink
Merge pull request #5 from cpanel/RE-745_path_fix
Browse files Browse the repository at this point in the history
Re 745 path fix
  • Loading branch information
davelcpanelnet authored Oct 29, 2024
2 parents da79662 + ff5aa80 commit 90bc662
Show file tree
Hide file tree
Showing 27 changed files with 951 additions and 58 deletions.
20 changes: 20 additions & 0 deletions .github/create_check
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

OWNER=cpanel
REPO=elevate-actions
COMMIT=dcba4f168b5aa17dc46fe04e8ba00691580765ba
CHECK_NAME="Dave Check"

gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${OWNER}/${REPO}/check-runs \
-f "name=${CHECK_NAME}" \
-f "head_sha=${COMMIT}" \
-f "status=in_progress" \
-f "external_id=42" \
-f "started_at=2018-05-04T01:14:52Z" \
-f "output[title]=The Report of all reports" \
-f "output[summary]=Things went boomski" \
-f "output[text]=May want to run another check, there, boss."
73 changes: 73 additions & 0 deletions .github/workflows/openstack/prune_openstack
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env bash

export OS_AUTH_TYPE=v3applicationcredential
export OS_AUTH_URL=https://keystone.hou-01.cloud.prod.cpanel.net:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_REGION_NAME="RegionOne"
export OS_INTERFACE=public
export OS_APPLICATION_CREDENTIAL_ID=${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
export OS_APPLICATION_CREDENTIAL_SECRET=${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}

# two hours ago
HAMMER_TIME=$(date -d '-2 hour' --utc +"%Y-%m-%dT%H:%M:%SZ")

get_elevatebcl_instances () {
LIST=$(openstack server list -f json --no-name-lookup | jq -r .[].ID)
rm id_created_name.txt > /dev/null 2>&1
while IFS= read -r VM; do
openstack server show -f json "$VM" | jq -r '.id + "," + .created + "," + .name' | grep packer >> id_created_name.txt
done <<< "$LIST"
}

remove_stale_instances () {
echo "HAMMERTIME: $HAMMER_TIME"
while IFS="," read -r ID CREATED_DATE NAME
do
if [[ $CREATED_DATE < $HAMMER_TIME ]];
then
echo "deleting: $ID,$CREATED_DATE,$NAME"
openstack server delete "$ID"
fi
done < <(cat id_created_name.txt)
}

get_keys () {
LIST=$(openstack keypair list -f json | jq -r .[].Name)
rm keyid_created_name.txt > /dev/null 2>&1
while IFS= read -r KEYPAIR; do
openstack keypair show -f json "$KEYPAIR" | jq -r '.id + "," + .created_at + "," + .name' | grep deletethis >> keyid_created_name.txt
done <<< "$LIST"
}

remove_stale_keys () {
echo "HAMMERTIME: $HAMMER_TIME"
while IFS="," read -r ID CREATED_DATE NAME
do
if [[ $CREATED_DATE < $HAMMER_TIME ]];
then
echo "deleting: $ID,$CREATED_DATE,$NAME"
openstack keypair delete "$ID"
fi
done < <(cat keyid_created_name.txt)
}

get_volumes () {
rm volume_ids.txt > /dev/null 2>&1
openstack volume list | grep packer | grep available | awk '{print $2}' >> volume_ids.txt
}

remove_volumes () {
while IFS= read -r ID; do
openstack volume delete "$ID" || true
done < <(cat volume_ids.txt)
}

# prune VMs
get_packer_instances
remove_stale_instances
# prune keys
get_keys
remove_stale_keys
# prune volumes
get_volumes
remove_volumes
12 changes: 12 additions & 0 deletions .github/workflows/pruner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Openstack Pruner
run-name: Openstack Pruner
on:
schedule:
- cron: '*/5 * * * *'
jobs:
run-pruner:
runs-on: [self-hosted]
steps:
- uses: actions/checkout@v4
- name: Run Openstack Pruner
run: ./prune_openstack
9 changes: 9 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
##### **2024-10-28** - version 56

* Fixed case RE-812: Fix elevate failures stemming from having a customized epel.repo file.
* Fixed case RE-575: Support running elevate on systems that have the Acronis backup agent installed.
* Fixed case RE-652: Attempt to resolve duplicate RPMs found prior to upgrade.
* Fixed case RE-723: Use mv and cp from File::Copy instead of copy and move
* Fixed case RE-862: Ensure Imunify upgrade is not executing before attempting to uninstall it
* Fixed case RE-673: Merge blockers into components

##### **2024-09-30** - version 55
* Add support for "cl7h" (Cloud Linux 7 Hybrid) repository.

Expand Down
Loading

0 comments on commit 90bc662

Please sign in to comment.