Skip to content

[ci]: Cleanup the workspace#2142

Merged
prsunny merged 3 commits into
sonic-net:masterfrom
xumia:fix-checkout-issue
Feb 9, 2022
Merged

[ci]: Cleanup the workspace#2142
prsunny merged 3 commits into
sonic-net:masterfrom
xumia:fix-checkout-issue

Conversation

@xumia

@xumia xumia commented Feb 9, 2022

Copy link
Copy Markdown
Collaborator

What I did
Cleanup the workspace.
Why I did it
In some of the test cases, it is run as root, left some of the file cannot be removed during the checkout step.

Example: https://dev.azure.com/mssonic/build/_build/results?buildId=71009&view=logs&j=3f6395b2-1619-5ebe-f305-2aedcf353cb5&t=aa8a4b4e-56c0-53e8-6540-01f05ca983a1

$ ls -l /agent/_work/1/s/tests/.pytest_cache/CACHEDIR.TAG
-rw-r--r-- 1 root root 194 Feb  8 13:28 /agent/_work/1/s/tests/.pytest_cache/CACHEDIR.TAG

$ ls -l /agent/_work/1/s/ -d
drwxr-xr-x 25 AzDevOps AzDevOps 4096 Feb  8 17:11 /agent/_work/1/s/

How I verified it

Details if related

prsunny
prsunny previously approved these changes Feb 9, 2022

steps:
- script: |
sudo rm -rf $(ls -A1)

@qiluo-msft qiluo-msft Feb 9, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sudo rm -rf $(ls -A1)

This combination has risk. For example there is a filename as 'a b', and rm will try rm a b which is removing two files.

And ls could output colors in ANSI sequence.

@xumia xumia Feb 9, 2022

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qiluo-msft , the command is running before any script start, so it is to make the whole workspace clean. It is expected, there are no files as the agent hosted by Microsoft.
I changed the PR title and the description.

@xumia xumia changed the title [ci]: Cleanup the source folder before checking out code [ci]: Cleanup the workspace Feb 9, 2022
@xumia

xumia commented Feb 9, 2022

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@prsunny prsunny merged commit d9e72a9 into sonic-net:master Feb 9, 2022
qiluo-msft pushed a commit that referenced this pull request Feb 9, 2022
* Cleanup the workspace. In some of the test cases, it is run as root, left some of the file cannot be removed during the checkout step.
prsunny added a commit to sonic-net/sonic-swss-common that referenced this pull request Feb 10, 2022
judyjoseph pushed a commit that referenced this pull request Feb 14, 2022
* Cleanup the workspace. In some of the test cases, it is run as root, left some of the file cannot be removed during the checkout step.
qiluo-msft pushed a commit to qiluo-msft/sonic-swss that referenced this pull request Feb 14, 2022
* Cleanup the workspace. In some of the test cases, it is run as root, left some of the file cannot be removed during the checkout step.
preetham-singh pushed a commit to preetham-singh/sonic-swss that referenced this pull request Aug 6, 2022
* Cleanup the workspace. In some of the test cases, it is run as root, left some of the file cannot be removed during the checkout step.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants