Skip to content

Commit

Permalink
Merge branch 'Azure:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Tejaswikandula authored Aug 1, 2024
2 parents fe38e59 + 27b9c30 commit f4c980f
Show file tree
Hide file tree
Showing 576 changed files with 109,329 additions and 49,204 deletions.
7 changes: 7 additions & 0 deletions .github/template/non-security-comment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Hi, this inquiry has been well received albeit being triaged as non-security related ask.

Azure CLI is currently prioritizing direct SFI requirements and items and this request does not seem to be related to SFI. We'll retain it in our backlog at this point. Please reach out to AzPyCli@microsoft.com if you'd justify it's highly customer-impacted and need to be escalated.

Thank you,

Azure CLI team
25 changes: 25 additions & 0 deletions .github/workflows/AddIssueCommentWithLabel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Comment Issue when labeled non-security
on:
issues:
types: [opened, labeled, unlabeled]

jobs:
comment-non-security:
if: contains(github.event.issue.labels.*.name, 'non-security')
runs-on: ubuntu-20.04
permissions:
issues: write
name: Comment on issue
steps:
- name: Checkout comment message
uses: actions/checkout@v4
with:
sparse-checkout: |
.github/template/non-security-comment.md
- name: Comment on issue with no security label
uses: mshick/add-pr-comment@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
message-id: issueNoSecurityCommentBot
message-path: |
.github/template/non-security-comment.md
187 changes: 131 additions & 56 deletions .github/workflows/VersionCalPRComment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
branches:
- main
paths:
- '**.py'
- '!**/test_*.py'

permissions: {}
Expand All @@ -17,29 +16,42 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-cal-version') && (!contains(fromJSON('["labeled", "unlabeled"]'), github.event.action) || github.event.label.name != 'release-version-block') }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
pull-requests: read
contents: read
steps:
- name: Set Init Version Message
- name: Check Init GH Event
env:
action: ${{ toJSON(github.event.action) }}
label: ${{ toJSON(github.event.label) }}
run: |
echo "message=$(echo 'Suggested init version: 1.0.0b1 for preview release and 1.0.0 for stable release')" >> $GITHUB_ENV
- name: Set up Python 3.10
echo version cal job start
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.10"
python-version: "3.11"
- name: Checkout CLI extension repo
uses: actions/checkout@master
uses: actions/checkout@v4
with:
fetch-depth: 0 # checkout all branches
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }} # checkout pull request branch
- name: Show workdirectory after site cloned
- name: Show work directory after site cloned
run: |
pwd
ls
- name: Set Default Version Output
env:
result_path: "./cal_result"
output_file: "version_update.txt"
remove_labels_file: "labels_removed.txt"
run: |
set -x
mkdir "$result_path"
cd "$result_path"
echo " - For more info about extension versioning, please refer to [Extension version schema](https://github.com/Azure/azure-cli/blob/release/doc/extensions/versioning_guidelines.md)" > "$output_file"
echo "release-version-block" > "$remove_labels_file"
cd ../
ls "$result_path"
- name: Get Diff Files
env:
bash_sha: ${{ github.event.pull_request.base.sha }}
Expand All @@ -64,28 +76,34 @@ jobs:
cat changed_files | grep azext_ | awk -F"azext_" '{print $1}'| awk -F"/" '{print $2}' | sort | uniq > changed_modules
echo "changed_module_list=$(cat changed_files | grep azext_ | awk -F"azext_" '{print $1}'| awk -F"/" '{print $2}' | sort | uniq | xargs)" >> $GITHUB_ENV
git --no-pager diff --diff-filter=ACMRT "$base_branch_pre"/"$base_branch"..."$diff_branch" > "$diff_code_file"
- name: Display Diff Modules
- name: Display PR Diff Modules
run: |
for mod in "$changed_module_list"
do
echo changed module: "${mod}"
done
for mod in "$changed_module_list"
do
echo changed module: "${mod}"
done
if [ -z "$changed_module_list" ]; then
echo "no_changed_mod=true" >> $GITHUB_ENV
else
echo "no_changed_mod=false" >> $GITHUB_ENV
fi
- name: Checkout CLI main repo
uses: actions/checkout@master
if: ${{ env.no_changed_mod == 'false' }}
uses: actions/checkout@v4
with:
repository: Azure/azure-cli
path: ./azure-cli
- name: Show workdirectory after cli cloned
run: |
pwd
ls
- name: Move the main repo to the same level as the extension repo
if: ${{ env.no_changed_mod == 'false' }}
run: |
mv azure-cli ../
cd ../
pwd
ls
pwd
ls
mv azure-cli ../
cd ../
pwd
ls
- name: Install azdev
if: ${{ env.no_changed_mod == 'false' }}
run: |
python -m pip install --upgrade pip
set -ev
Expand All @@ -99,6 +117,7 @@ jobs:
az --version
pip list -v
- name: Gen Base and Diff Metadata
if: ${{ env.no_changed_mod == 'false' }}
id: get_comment_message
env:
pr_label_list: ${{ toJson(github.event.pull_request.labels.*.name) }}
Expand All @@ -108,47 +127,103 @@ jobs:
diff_branch: ${{ github.event.pull_request.head.ref }}
base_meta_path: "./base_meta/"
diff_meta_path: "./diff_meta/"
result_path: "./cal_result"
output_file: "version_update.txt"
add_labels_file: "labels_added.json"
remove_labels_file: "labels_removed.txt"
run: |
chmod +x env/bin/activate
source ./env/bin/activate
set -ev
git checkout "$base_branch_pre"/"$base_branch"
mkdir "$base_meta_path"
for mod in "$changed_module_list"
do
echo changed module: "${mod}"
azdev extension add "${mod}" && azdev command-change meta-export "${mod}" --meta-output-path ./"$base_meta_path"/ && azdev extension remove "${mod}"
done
git checkout "$diff_branch"
mkdir "$diff_meta_path"
for mod in "$changed_module_list"
do
echo changed module: "${mod}"
azdev extension add "${mod}" && azdev command-change meta-export "${mod}" --meta-output-path ./"$diff_meta_path"/ && azdev extension remove "${mod}"
done
ls ./"$base_meta_path"/
ls ./"$diff_meta_path"/
git checkout "$base_branch_pre"/"$base_branch"
python scripts/ci/release_version_cal.py
# echo "commit_message=$(cat $output_file)" >> $GITHUB_ENV
chmod +x env/bin/activate
source ./env/bin/activate
set -ev
git checkout "$base_branch_pre"/"$base_branch"
mkdir "$base_meta_path"
for mod in "$changed_module_list"
do
echo changed module: "${mod}"
azdev extension add "${mod}" && azdev command-change meta-export "${mod}" --meta-output-path ./"$base_meta_path"/ && azdev extension remove "${mod}"
done
git checkout "$diff_branch"
mkdir "$diff_meta_path"
for mod in "$changed_module_list"
do
echo changed module: "${mod}"
azdev extension add "${mod}" && azdev command-change meta-export "${mod}" --meta-output-path ./"$diff_meta_path"/
done
ls ./"$base_meta_path"/
ls ./"$diff_meta_path"/
ls "$result_path"
git checkout "$base_branch_pre"/"$base_branch" -- scripts
python scripts/ci/release_version_cal.py
ls "$result_path"
cat "$result_path"/"$remove_labels_file"
# echo "commit_message=$(cat $output_file)" >> $GITHUB_ENV
- name: Archive pr version cal output
uses: actions/upload-artifact@v4
with:
name: version-cal-output
path: |
cal_result
!cal_result/**/*.md
version-output:
needs: version-cal
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- name: Check Init GH Event
env:
action: ${{ toJSON(github.event.action) }}
label: ${{ toJSON(github.event.label) }}
run: |
echo version output job start
- name: Download version cal result
uses: actions/download-artifact@v4
with:
name: version-cal-output
- name: Show work directory after result downloaded
run: |
pwd
ls
- name: Check comment file existence
id: check_comment_file
uses: andstor/file-existence-action@v3
with:
files: "./version_update.txt"
- name: Comment on the pull request
if: steps.check_comment_file.outputs.files_exists == 'true'
uses: mshick/add-pr-comment@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
message-id: versioncommentbot
message-path: |
repo-token: ${{ secrets.GITHUB_TOKEN }}
message-id: versioncommentbot
message-path: |
version_update.txt
message-failure: |
message-failure: |
Please refer to [Extension version schema](https://github.com/Azure/azure-cli/blob/release/doc/extensions/versioning_guidelines.md) to update release versions.
- name: Check add label file existence
id: check_add_label_file
uses: andstor/file-existence-action@v3
with:
files: "./labels_added.json"
- name: Add block release label
uses: actions-ecosystem/action-add-labels@v1
if: ${{ steps.get_comment_message.outputs.BlockPR == 1 }}
if: steps.check_add_label_file.outputs.files_exists == 'true'
run: |
cat labels_added.json
curl -X POST \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d @labels_added.json
- name: Check delete label file existence
id: check_delete_label_file
uses: andstor/file-existence-action@v3
with:
labels: release-version-block
files: "./labels_removed.txt"
- name: Remove block release label
uses: mondeja/remove-labels-gh-action@v2
if: ${{ steps.get_comment_message.outputs.BlockPR == 0 }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: release-version-block
if: steps.check_delete_label_file.outputs.files_exists == 'true'
run: |
for del_lab in `sed 's/[^a-zA-Z0-9_ \-]//g' labels_removed.txt | sort | uniq | xargs`
do
curl -X DELETE \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/${del_lab}" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}"
done
Loading

0 comments on commit f4c980f

Please sign in to comment.