From 7f637711750930ad3e1e6918d1cb32dd25069f40 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Mon, 25 Nov 2024 16:57:46 +0000 Subject: [PATCH] [ci] cleanup Azure Pipeline templates that are unused Signed-off-by: Gary Guo --- ci/checkout-template.yml | 27 --------- ci/download-artifacts-template.yml | 62 -------------------- ci/install-package-dependencies.yml | 31 ---------- ci/load-bazel-cache-write-creds.yml | 17 ------ ci/publish-bazel-test-results.yml | 19 ------ ci/upload-artifacts-template.yml | 90 ----------------------------- 6 files changed, 246 deletions(-) delete mode 100644 ci/checkout-template.yml delete mode 100644 ci/download-artifacts-template.yml delete mode 100644 ci/install-package-dependencies.yml delete mode 100644 ci/load-bazel-cache-write-creds.yml delete mode 100644 ci/publish-bazel-test-results.yml delete mode 100644 ci/upload-artifacts-template.yml diff --git a/ci/checkout-template.yml b/ci/checkout-template.yml deleted file mode 100644 index ef99fe35ffdfb..0000000000000 --- a/ci/checkout-template.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright lowRISC contributors (OpenTitan project). -# Licensed under the Apache License, Version 2.0, see LICENSE for details. -# SPDX-License-Identifier: Apache-2.0 - -# This template downloads the version of the repository checked out in the first -# pipeline job. -# This ensures that every pipeline job runs on the same version of the -# repository instead of having Azure perform the checkout each time. More -# information can be found in #13993. - -# The first job in the pipeline must use the default Azure checkout job to -# fetch the repository. It creates opentitan-repo.tar.gz and uploads it as an -# artifact. This template downloads the repo into -# $(Pipeline.Workspace)/opentitan-repo. The files are locaed in -# $(Pipeline.Workspace)/opentitan-repo/opentitan-repo.tar.gz. This is untarred -# into the working directory. - -steps: - - checkout: none # Suppress the default checkout action - - download: current - artifact: opentitan-repo - displayName: Download repository - - bash: | - tar -xf $(Pipeline.Workspace)/opentitan-repo/opentitan-repo.tar.gz --no-same-owner - # --no-same-owner is required since Azure runs this command as root which - # preserves ownership. Git will complain about this. - displayName: Unpack repository diff --git a/ci/download-artifacts-template.yml b/ci/download-artifacts-template.yml deleted file mode 100644 index cc191846e77d6..0000000000000 --- a/ci/download-artifacts-template.yml +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright lowRISC contributors (OpenTitan project). -# Licensed under the Apache License, Version 2.0, see LICENSE for details. -# SPDX-License-Identifier: Apache-2.0 - -# Azure template for downloading pipeline step outputs and unpacking them. -# -# This template will download all artifacts from the upstream jobs listed in -# `downloadPartialBuildBinFrom` (which are expected to use -# upload-artifacts-template.yml) and unpack them. -# -# This template expects that a variable $BUILD_ROOT is set to a writeable -# directory; the results will be available in $BIN_DIR. See -# util/build_consts.sh for more information. - -parameters: - # Names of jobs to download a partial $BIN_DIR from. - # List all "upstream" jobs here which produce files in $BIN_DIR which are - # needed in the current job. In other words, list all jobs which need to be - # executed and produce some build outputs before this job can start. The - # current job will find all outputs from those upstream jobs in $BIN_DIR and - # can use them. - - name: downloadPartialBuildBinFrom - type: object - default: [] - -steps: - - ${{ each job in parameters.downloadPartialBuildBinFrom }}: - - task: DownloadPipelineArtifact@2 - inputs: - buildType: current - path: '$(BUILD_ROOT)/downloads/${{ job }}' - artifact: "partial-build-bin-${{ job }}" - displayName: Downloading partial build-bin directory from job ${{ job }} - - bash: | - set -e - test -n "$BUILD_ROOT" - . util/build_consts.sh - - test -f "$BUILD_ROOT/upstream_bin_dir_contents.txt" && { - echo The download-artifacts-template.yml template can be called only once per job. - exit 1 - } - - mkdir -p "$BIN_DIR" - - echo 'Extracting partial BIN_DIRs:' - find "$BUILD_ROOT/downloads" \ - -name 'build-bin.tar' \ - -exec \ - tar -C "$BIN_DIR" \ - --strip-components=1 \ - -xvf {} \; - - # Remember all files which were present in the upstream $BIN_DIRs. - find "$BIN_DIR" -type f -fprintf "$BUILD_ROOT/upstream_bin_dir_contents.txt" '%P\n' - - echo - echo Upstream BIN_DIR contents: - echo vvvvvvvvvvvvvvvvvv - cat "$BUILD_ROOT/upstream_bin_dir_contents.txt" - echo ^^^^^^^^^^^^^^^^^^ - displayName: Unpack upstream outputs diff --git a/ci/install-package-dependencies.yml b/ci/install-package-dependencies.yml deleted file mode 100644 index a920e5abfe05f..0000000000000 --- a/ci/install-package-dependencies.yml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright lowRISC contributors (OpenTitan project). -# Licensed under the Apache License, Version 2.0, see LICENSE for details. -# SPDX-License-Identifier: Apache-2.0 - -# Azure template for installing dependencies from various package managers, -# necessary for building, testing, and packaging OpenTitan. -# -# This template can be included from pipelines in other repositories. -# In this case, set the REPO_TOP parameter to point to the root of the -# checked out opentitan repository. -# -# This template executes: -# - apt-get (*) install for all packages listed in apt-requirements.txt -# - pip install for all packages listed in python-requirements.txt -# -# * As an optimization, apt-fast is used instead of apt-get if it is available. - -parameters: -- name: REPO_TOP - type: string - default: . - -steps: - - bash: | - set -e - cd ${{ parameters.REPO_TOP }} - ci/install-package-dependencies.sh \ - --verilator-version $(VERILATOR_VERSION) \ - --verible-version $(VERIBLE_VERSION) - retryCountOnTaskFailure: 3 - displayName: 'Install package dependencies' diff --git a/ci/load-bazel-cache-write-creds.yml b/ci/load-bazel-cache-write-creds.yml deleted file mode 100644 index 105ca60cfd0cf..0000000000000 --- a/ci/load-bazel-cache-write-creds.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright lowRISC contributors (OpenTitan project). -# Licensed under the Apache License, Version 2.0, see LICENSE for details. -# SPDX-License-Identifier: Apache-2.0 - -# Azure Pipelines template for downloading a "secure file" containing the write -# credentials for a GCP bucket where we store a Bazel cache. -# -# The path to the downloaded file is automatically stored in an environment -# variable `GCP_BAZEL_CACHE_KEY_SECUREFILEPATH`. This file is loaded by the -# `ci/bazelisk.sh` script. - -steps: - - task: DownloadSecureFile@1 - condition: eq(variables['Build.SourceBranchName'], 'master') - name: GCP_BAZEL_CACHE_KEY - inputs: - secureFile: "bazel_cache_gcp_key.json" diff --git a/ci/publish-bazel-test-results.yml b/ci/publish-bazel-test-results.yml deleted file mode 100644 index 73d7392a169a7..0000000000000 --- a/ci/publish-bazel-test-results.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright lowRISC contributors (OpenTitan project). -# Licensed under the Apache License, Version 2.0, see LICENSE for details. -# SPDX-License-Identifier: Apache-2.0 - -# Azure template for publishing `bazel test` results on Azure and GitHub -# checks. -# -# This template can be included from pipelines in other repositories. -# It expects the source code to be checked out at $(Build.SourcesDirectory). -# - -steps: - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'JUnit' - testResultsFiles: '**/test.xml' - searchFolder: ' $(Build.SourcesDirectory)/bazel-out' - displayName: 'Publish bazel test results' - condition: succeededOrFailed() diff --git a/ci/upload-artifacts-template.yml b/ci/upload-artifacts-template.yml deleted file mode 100644 index e42e6c7f130ab..0000000000000 --- a/ci/upload-artifacts-template.yml +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright lowRISC contributors (OpenTitan project). -# Licensed under the Apache License, Version 2.0, see LICENSE for details. -# SPDX-License-Identifier: Apache-2.0 - -# Azure template for archiving pipeline step outputs and uploading them. -# -# This template will archive all of $BIN_DIR, and upload it for use by -# downstream jobs using download-artifacts-template.yml. -# -# This template expects that a variable $BUILD_ROOT is set. See -# util/build_consts.sh for more information. - - -parameters: - # Rsync-style file patterns to include in the partial BIN_DIR output. If a - # file is captured by these patterns, but it was previously downloaded via - # ci/download-artifacts-template.yml, it will not be uploaded again. - - name: includePatterns - type: object - default: [] - # Rsync-style file patterns to unconditionally include in the partial BIN_DIR - # output. If a file is captured by these patterns, it will be uploaded even if - # it came from ci/download-artifacts-template.yml. - - name: unconditionalIncludePatterns - type: object - default: [] - -steps: - - bash: | - set -e - test -n "$BUILD_ROOT" - . util/build_consts.sh - - # Write all sets of include patterns to files used by rsync. - echo -e "${{ join('\n', parameters.includePatterns) }}" > "$BUILD_ROOT/include_patterns.txt" - echo -e "${{ join('\n', parameters.unconditionalIncludePatterns) }}" > "$BUILD_ROOT/unconditional_include_patterns.txt" - - echo - echo Files matching these patterns will be included in the binary build - echo artifact for this job unless they were downloaded from an upstream job: - echo vvvvvvvvvvvvvvvvvv - cat "$BUILD_ROOT/include_patterns.txt" - echo ^^^^^^^^^^^^^^^^^^ - - echo - echo Files matching these patterns will always be included in the binary - echo build artifact for this job: - echo vvvvvvvvvvvvvvvvvv - cat "$BUILD_ROOT/unconditional_include_patterns.txt" - echo ^^^^^^^^^^^^^^^^^^ - - # The file upstream_bin_dir_contents.txt lists all files which were part - # of an "upstream" BIN_DIR which got downloaded at the beginning of this - # job. Ensure that this file exists, even if no upstream BIN_DIR was - # downloaded. - touch "$BUILD_ROOT/upstream_bin_dir_contents.txt" - - BIN_DIR_FULL="${BIN_DIR}.full" - mv "$BIN_DIR" "$BIN_DIR_FULL" - mkdir -p "$BIN_DIR" - - echo - echo Copying files into the output archive: - rsync \ - --archive \ - --verbose \ - --remove-source-files \ - --prune-empty-dirs \ - --include-from="$BUILD_ROOT/unconditional_include_patterns.txt" \ - --exclude-from="$BUILD_ROOT/upstream_bin_dir_contents.txt" \ - --include="*/" \ - --include-from="$BUILD_ROOT/include_patterns.txt" \ - --exclude="*" \ - "${BIN_DIR_FULL}/" "${BIN_DIR}/" - - echo - echo 'Files in $BIN_DIR not considered outputs of this job:' - echo vvvvvvvvvvvvvvvvvv - find "$BIN_DIR_FULL" - echo ^^^^^^^^^^^^^^^^^^ - - tar -C "$BUILD_ROOT" \ - -cvf "$BUILD_ROOT/build-bin.tar" \ - "${BIN_DIR#"$BUILD_ROOT/"}" - displayName: Archive step outputs - - publish: "$(Build.ArtifactStagingDirectory)/build-bin.tar" - # The PhaseName is the string after the "job" key in the build description, - # e.g. "job: my_phase_name". - artifact: partial-build-bin-$(System.PhaseName) - displayName: Upload step outputs