From 6d20cc2b93e4ef81d5fabf55e94bc42986b38df0 Mon Sep 17 00:00:00 2001 From: Anahide Tchertchian <608958+atchertchian@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:52:59 +0100 Subject: [PATCH] AAE-18008: Make dependabot update actions (#344) Co-authored-by: Giovanni Toraldo --- .github/dependabot.template.yml | 13 ++ .github/dependabot.yml | 252 +++++++++++++++++++++++++++++++- .pre-commit-config.yaml | 7 + update-dependabot.sh | 43 ++++++ 4 files changed, 313 insertions(+), 2 deletions(-) create mode 100644 .github/dependabot.template.yml create mode 100755 update-dependabot.sh diff --git a/.github/dependabot.template.yml b/.github/dependabot.template.yml new file mode 100644 index 000000000..20e6632ca --- /dev/null +++ b/.github/dependabot.template.yml @@ -0,0 +1,13 @@ +# Documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# Edit should be made in the dependabot.template.yml +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "pip" + directory: "/.github/actions/pipenv" + schedule: + interval: "monthly" diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b66d06938..620018e91 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,13 +1,261 @@ # Documentation for all configuration options: # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# Edit should be made in the dependabot.template.yml version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" - + interval: "weekly" - package-ecosystem: "pip" directory: "/.github/actions/pipenv" schedule: interval: "monthly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/automate-dependabot" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/automate-propagation" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/calculate-next-internal-version" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/configure-git-author" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/dbp-charts" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/docker-build-image" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/docker-dump-containers-logs" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/docker-scan-image-dirs" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/env-load-from-yaml" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/free-hosted-runner-disk-space" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/get-branch-name" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/get-build-info" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/get-commit-message" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/git-check-existing-tag" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/git-commit-changes" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/git-latest-tag" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/helm-build-chart" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/helm-integration-tests" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/helm-package-chart" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/helm-parse-next-release" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/helm-plugin" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/helm-publish-chart" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/helm-release-and-publish" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/helm-template-yamllint" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/helm-update-chart-version" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/jx-updatebot-pr" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/kubectl-keep-nslogs" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/load-release-descriptor" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/maven-build-and-tag" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/maven-deploy-file" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/maven-release" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/maven-update-pom-version" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/nexus-close-staging" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/nexus-create-staging" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/nexus-release-staging" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/pipenv" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/pre-commit" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/pre-commit-default" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/process-coverage-report" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/rancher" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/reportportal-prepare" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/reportportal-summarize" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/resolve-preview-name" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/send-slack-notification" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/send-slack-notification-slow-job" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/send-teams-notification" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-github-release-binary" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-helm-docs" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-java-build" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-jx-release-version" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-kcadm" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-kind" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-kubepug" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-pysemver" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-rancher-cli" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-terraform-docs" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/setup-updatebot" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/update-deployment-runtime-versions" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/update-pom-to-next-pre-release" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/update-project-base-tag" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/validate-maven-versions" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/.github/actions/veracode" + schedule: + interval: "weekly" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 117a32f66..56723b464 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,3 +23,10 @@ repos: rev: v0.32.2 hooks: - id: markdownlint + - repo: local + hooks: + - id: generate-dependabot + name: Generate dependabot config for actions + language: system + entry: ./update-dependabot.sh + pass_filenames: false diff --git a/update-dependabot.sh b/update-dependabot.sh new file mode 100755 index 000000000..3519ba06a --- /dev/null +++ b/update-dependabot.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Directory containing composite actions +actions_dir='.github/actions' + +# Dependabot source config file +master_config='.github/dependabot.template.yml' + +# Dependabot target config file +dependabot_config='.github/dependabot.yml' + +# Temp file for new Dependabot config section +temp_config='temp_dependabot.yml' + +# Function to generate Dependabot config section for a composite action +generate_dependabot_section() { + local action_dir=$1 + echo " - package-ecosystem: \"github-actions\"" + echo " directory: \"/${action_dir}\"" + echo " schedule:" + echo " interval: \"weekly\"" +} + +# Check if Dependabot config exists +if [ ! -f "$master_config" ]; then + echo "$master_config config not found." + exit 1 +fi + +# Start building the new config section +echo "version: 2" > "$temp_config" +echo "updates:" >> "$temp_config" + +# Loop through composite actions and append to temp config +for action_dir in $(find "$actions_dir" -mindepth 1 -maxdepth 1 -type d | sort -n); do + generate_dependabot_section "$action_dir" >> "$temp_config" +done + +# Merge new section with existing Dependabot config using yq +yq eval-all '. as $item ireduce ({}; . *+ $item)' $master_config $temp_config > "$dependabot_config" + +# Clean up +rm "$temp_config"