diff --git a/.github/workflows/clean-acr.yml b/.github/workflows/clean-acr.yml deleted file mode 100644 index 0dfaf1f81c..0000000000 --- a/.github/workflows/clean-acr.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Clean ACR - -# Notes: To access key vault and grab the connection string, we first need a service principal. -# We need to add that service principal as a Reader in the RBAC for the key vault in question, -# as well as adding it with Get and List permissions in the key vault's access policies. -# Then we need to store that service principal's info as a GitHub secret. -# We then use that secret here as the credentials for logging into Azure. -# Instructions are here: https://learn.microsoft.com/en-us/azure/developer/github/github-key-vault -# In our case, the service principal is called synapseml-clean-acr. -# The github secret is a repository secret called clean_acr. -# It is backed up in the mmlspark-keys vault by secret clean-acr-github-actions-info. -# The secret has an expiration date (currently 11/20/2024), so it will need to be renewed at some point. - -on: - schedule: - - cron: "0 1 * * 0" # every sunday at 1am - -# Use workflow_dispatch in place of schedule for debugging. -# You can trigger the workflow in the 'Actions' tab in github. -# Apparently, this file must be in the master branch to get the 'Run workflow' button. -#on: -# workflow_dispatch: - -jobs: - clean-acr: - name: Clean ACR - runs-on: ubuntu-latest - steps: - - name: Log into Azure - uses: azure/login@v1 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - name: checkout repo content - uses: actions/checkout@v4 # checkout the repo - - name: setup python - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Execute clean-acr.py - uses: azure/CLI@v2 - with: - inlineScript: | - python -m venv acr-env - source acr-env/bin/activate - pip install --upgrade pip - pip install azure-storage-blob azure-identity azure-keyvault-secrets - python .github/workflows/scripts/clean-acr.py mmlspark-keys clean-acr-connection-string diff --git a/.pipelines/clean-acr.yml b/.pipelines/clean-acr.yml new file mode 100644 index 0000000000..0e8c0a9169 --- /dev/null +++ b/.pipelines/clean-acr.yml @@ -0,0 +1,29 @@ +trigger: + schedules: + - cron: "0 1 * * 0" + displayName: Weekly Cleanup + always: true + branches: + include: + - master + +pool: + vmImage: 'ubuntu-latest' + +variables: + azureServiceConnection: 'synapseml-clean-acr' # Name of the Azure service connection in Azure DevOps + +steps: + - task: AzureCLI@2 + displayName: 'Clean ACR' + inputs: + azureSubscription: 'SynapseML Build' + scriptLocation: inlineScript + scriptType: bash + inlineScript: | + set -e + pip install --upgrade pip + pip install azure-storage-blob azure-identity azure-keyvault-secrets + python tools/acr/clean-acr.py mmlspark-keys clean-acr-connection-string + + diff --git a/.github/workflows/scripts/clean-acr.py b/tools/acr/clean-acr.py similarity index 100% rename from .github/workflows/scripts/clean-acr.py rename to tools/acr/clean-acr.py