Fix yum repo cleanup#17334
Conversation
Previously, "${ARTIFACT_PATH}" was interpreted as Drone variable
subsitution, resulting in "rm -rf ${ARTIFACT_PATH}/*" becoming
"rm -rf /*", which deleted credentials on the filesystem.
16a942d to
94bee39
Compare
|
Yea I definitely missed that on my initial implementation in the linked PR I would recommend just doing Regarding testing... the only real way to test it is to inject "testing code" (like different secret names) that point to AWS resources in the dev account and then update the trigger to execute on branch push. Then revert those testing changes before merge. Very messy but it's the best way I'm aware of. |
Do you want me to test this? I can do so. I don't feel it is needed, but that is also how I got into this situation 😆 😭 |
Sorry yes you are correct. After reviewing the docs here it looks like
I think it's relatively safe to assume that this will work and fix the problem as expected. Quite frankly I think it'd take longer to test than it would to open/merge another PR with a follow-up fix should something go wrong during migration of the latest release. |
This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing.
This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing.
This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing.
This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing.
This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing.
This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing.
This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing.
This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing.
* Serialize apt/yum promote pipelines These were running in parallel, but we want them to run serially. Therefore, we add a dependency between each step and its previous step. * Allow dev build promotes to proceed in deb/rpm pipelines This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing. * Fix globbing bug This bug does not appear to affect anything currently. However it should be fixed in case the rm is important at some point in the future. The bug is: when a wildcard is inside quotes, it is treated as a literal filename. So rm -rf "$ARTIFACT_PATH/*" tries to remove the file named '*' instead of trying to remove everything in artifact path. * Swap YUM_REPO_NEW_ROLE to YUM_REPO_NEW_AWS_ROLE All other roles environment variables end in AWS_ROLE, and consistency is our friend here.
* Serialize apt/yum promote pipelines These were running in parallel, but we want them to run serially. Therefore, we add a dependency between each step and its previous step. * Allow dev build promotes to proceed in deb/rpm pipelines This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing. * Fix globbing bug This bug does not appear to affect anything currently. However it should be fixed in case the rm is important at some point in the future. The bug is: when a wildcard is inside quotes, it is treated as a literal filename. So rm -rf "$ARTIFACT_PATH/*" tries to remove the file named '*' instead of trying to remove everything in artifact path. * Swap YUM_REPO_NEW_ROLE to YUM_REPO_NEW_AWS_ROLE All other roles environment variables end in AWS_ROLE, and consistency is our friend here.
* Serialize apt/yum promote pipelines These were running in parallel, but we want them to run serially. Therefore, we add a dependency between each step and its previous step. * Allow dev build promotes to proceed in deb/rpm pipelines This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing. * Fix globbing bug This bug does not appear to affect anything currently. However it should be fixed in case the rm is important at some point in the future. The bug is: when a wildcard is inside quotes, it is treated as a literal filename. So rm -rf "$ARTIFACT_PATH/*" tries to remove the file named '*' instead of trying to remove everything in artifact path.
* Serialize apt/yum promote pipelines These were running in parallel, but we want them to run serially. Therefore, we add a dependency between each step and its previous step. * Allow dev build promotes to proceed in deb/rpm pipelines This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing. * Fix globbing bug This bug does not appear to affect anything currently. However it should be fixed in case the rm is important at some point in the future. The bug is: when a wildcard is inside quotes, it is treated as a literal filename. So rm -rf "$ARTIFACT_PATH/*" tries to remove the file named '*' instead of trying to remove everything in artifact path.
* Serialize apt/yum promote pipelines These were running in parallel, but we want them to run serially. Therefore, we add a dependency between each step and its previous step. * Allow dev build promotes to proceed in deb/rpm pipelines This helps test a couple more changes from this pipeline when cutting a dev build. Particularly, we saw the download and role assumption steps fail in #17334, and this change would have allowed us to catch that error during testing. * Fix globbing bug This bug does not appear to affect anything currently. However it should be fixed in case the rm is important at some point in the future. The bug is: when a wildcard is inside quotes, it is treated as a literal filename. So rm -rf "$ARTIFACT_PATH/*" tries to remove the file named '*' instead of trying to remove everything in artifact path. * Swap YUM_REPO_NEW_ROLE to YUM_REPO_NEW_AWS_ROLE All other roles environment variables end in AWS_ROLE, and consistency is our friend here.
Previously, "${ARTIFACT_PATH}" was interpreted as Drone variable subsitution, resulting in
"rm -rf ${ARTIFACT_PATH}/*"becoming"rm -rf /*", which deleted credentials on the filesystem. This causes the error seen here:https://drone.platform.teleport.sh/gravitational/teleport/16371/2/5
This has been latent in the publishing logic for since https://github.com/gravitational/teleport/pull/14203/files#diff-b54b39f1afced2465e1f3641db9d5bbf4f3a7fcf890996dfedd3c197bcb7f8c7R5472, but it happened to not matter because we weren't storing anything important in the container's filesystem. I do wonder how the
awscommand was still available following the delete.Backports:
Testing Done
None -- a development build won't ever hit these codepaths. I'm happy to take suggestions of how we might test it.