diff --git a/.github/workflows/cd-pipeline.yaml b/.github/workflows/cd-pipeline.yaml index bdbca0e02248..0cf69cecfcda 100644 --- a/.github/workflows/cd-pipeline.yaml +++ b/.github/workflows/cd-pipeline.yaml @@ -1,4 +1,4 @@ -name: CD Pipeline +name: '[CI/CD] CD Pipeline' on: # rebuild any PRs and main branch changes push: branches: @@ -83,18 +83,25 @@ jobs: - id: get-container-metadata name: Get image tag and container name run: | - # Now EAM commits has the following format "[bitnami/] Release " - tag="$(git log --pretty=tformat:"%s" -n 1 --grep="[R|r]elease" --author bitnami-bot@vmware.com --author containers@bitnami.com --author containers-bot@bitnami.com -- ${{ matrix.container }} | sed "s|\[.*\]||" | sed "s|[R|r]elease||" | awk '{print $1}')" - if [[ -z "${tag}" ]]; then - echo "No tag found for: ${{ matrix.container }}" - exit 1 + if [[ -d "${{ matrix.container }}" ]]; then + # Now EAM commits has the following format "[bitnami/] Release " + tag="$(git log --pretty=tformat:"%s" -n 1 --grep="[R|r]elease" --author bitnami-bot@vmware.com --author containers@bitnami.com --author containers-bot@bitnami.com -- ${{ matrix.container }} | sed "s|\[.*\]||" | sed "s|[R|r]elease||" | awk '{print $1}')" + if [[ -z "${tag}" ]]; then + echo "No tag found for: ${{ matrix.container }}" + exit 1 + else + name="$(echo "${{ matrix.container }}" | awk -F '/' '{print $2}')" + echo "::set-output name=tag::${tag}" + echo "::set-output name=name::${name}" + echo "::set-output name=result::ok" + fi else - name="$(echo "${{ matrix.container }}" | awk -F '/' '{print $2}')" - echo "::set-output name=tag::${tag}" - echo "::set-output name=name::${name}" + # Container folder doesn't exists we are assuming a deprecation + echo "::set-output name=result::skip" fi - uses: vmware-labs/vmware-image-builder-action@main - name: "Publish ${{ steps.get-container-metadata.outputs.name }}: ${{ steps.get-container-metadata.outputs.tag }}" + name: 'Publish ${{ steps.get-container-metadata.outputs.name }}: ${{ steps.get-container-metadata.outputs.tag }}' + if: ${{ steps.get-container-metadata.outputs.result == 'ok' }} with: pipeline: vib-publish.json env: diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml index beedfe83579b..bb4b158b266e 100644 --- a/.github/workflows/ci-pipeline.yaml +++ b/.github/workflows/ci-pipeline.yaml @@ -1,4 +1,4 @@ -name: CI Pipeline +name: '[CI/CD] CI Pipeline' on: # rebuild any PRs and main branch changes pull_request_target: types: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 0bf90080c817..064167569a90 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,4 +1,4 @@ -name: 'Close stale issues and PRs' +name: '[Support] Close stale issues and PRs' on: schedule: - cron: '0 1 * * *' diff --git a/.github/workflows/sync-deprecations.yaml b/.github/workflows/sync-deprecations.yaml deleted file mode 100644 index 57c8a1f1f6bd..000000000000 --- a/.github/workflows/sync-deprecations.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: Sync containers repositories - -on: - schedule: - # Every day at 1 AM - - cron: '0 1 * * *' - workflow_dispatch: -jobs: - build: - name: Sync deprecations - runs-on: ubuntu-latest - steps: - - name: Checkout bitnami/containers - uses: actions/checkout@v3 - with: - token: ${{ secrets.BITNAMI_BOT_SECRET }} - fetch-depth: 0 - - name: Sync Containers - run: ./scripts/sync-deprecations.sh \ No newline at end of file diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 99336b3a2ddf..afeb3a56755a 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -1,4 +1,4 @@ -name: 'Synchronize labels from the vms repository' +name: '[Support] Synchronize labels from the vms repository' on: schedule: # Daily diff --git a/scripts/sync-deprecations.sh b/scripts/sync-deprecations.sh deleted file mode 100755 index 8d28afc2f8f5..000000000000 --- a/scripts/sync-deprecations.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset -set -o pipefail -#set -o xtrace # Uncomment this line for debugging purpose - -TARGET_DIR="." - -######################## -# Query github api to get containers repositories -# Arguments: -# None -# Returns: -# None -######################### -queryRepos() { - local page=0 - local repos="[]" # Initial empty JSON array - local -r repos_per_page="100" - - while [[ "$page" -gt -1 ]]; do - # Query only the public repos since we won't add private containers to bitnami/containers - page_repos="$(curl -sH 'Content-Type: application/json' -H 'Accept: application/json' "https://api.github.com/orgs/bitnami/repos?type=public&per_page=${repos_per_page}&page=${page}")" - repos="$(jq -s 'reduce .[] as $x ([]; . + $x)' <(echo "$repos") <(echo "$page_repos"))" - n_repos="$(jq length <<< "$page_repos")" - if [[ "$n_repos" -lt "$repos_per_page" ]]; then - page="-1" - else - page="$((page + 1))" - fi - done - - echo "$repos" -} - -######################## -# Get non archived bitnami containers repositories -# Arguments: -# None -# Returns: -# None -######################### -getContainerRepos() { - local -r repos="$(queryRepos)" - local -r container_repos="$(jq -r '[ .[] | select(.name | test("bitnami-docker-.")) | select(.archived == false) ]' <<< "$repos")" - local result="" - while read -r repo_url; do - result="${result} ${repo_url:42}" - done < <(echo "$container_repos" | jq -r '.[].html_url' | uniq | sort) - echo "$result" -} - -######################## -# Set git user -# Arguments: -# None -# Returns: -# None -######################### -gitConfigure() { - git config --global user.name "Bitnami Containers" - git config --global user.email "bitnami-bot@vmware.com" -} - -######################## -# Push changes to right branch. -# Arguments: -# None -# Returns: -# None -######################### -pushChanges() { - git push origin "$(git rev-parse --abbrev-ref HEAD)" -} - -######################## -# Sync deprecations. -# Arguments: -# None -# Returns: -# None -######################### -syncDeprecations() { - gitConfigure # Configure Git client - mkdir -p "$TARGET_DIR" - local -r repos="$(getContainerRepos)" - - cd "${TARGET_DIR}/bitnami" || exit - for container in *; do - if [[ ! $repos =~ (^|[[:space:]])$container($|[[:space:]]) ]]; then - # Clean deprecated assets - echo "Removing container: ${container}" - rm -rf "${container}" - git add "${container}" - git commit -q -m "Remove deprecated container ${container}" - else - # Clean deprecated branches - git clone --quiet --depth 1 "https://github.com/bitnami/bitnami-docker-${container}" "/tmp/${container}" - cd "${container}" || exit - for branch in *; do - if [[ -d "${branch}" ]] && [[ ! -d "/tmp/${container}/${branch}" ]]; then - # Branch exists in bitnami/containers but it doesn't in bitnami-docker repo - echo "Removing branch: ${container}/${branch}" - rm -rf "${branch}" - git add "${branch}" - git commit -q -m "Remove deprecated branch ${container}/${branch}" - fi - done - cd - || exit - fi - done - - pushChanges -} - -syncDeprecations \ No newline at end of file