-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(job-attachment): Change group ownership and permission on job att…
…achment-owned files (#22) Signed-off-by: Gahyun Suh <[email protected]>
- Loading branch information
Showing
14 changed files
with
444 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## Scripts | ||
|
||
### Running Tests with Docker for File and Directory Permissions | ||
|
||
We have some unit tests that require being run in a specific docker container that is set up for testing with different users. Those unit tests are marked with `docker`, and the `run_sudo_tests.sh` script is provided to facilitate this testing. The script builds the Docker iamge using the Dockerfile located in `testing_containers/localuser_sudo_environment/`, and then runs the container. | ||
|
||
#### Usage | ||
Execute the script from the root of the repository. | ||
``` | ||
./scripts/run_sudo_tests.sh --build | ||
``` | ||
|
||
Or, you can run the hatch script: | ||
``` | ||
hatch run test_docker | ||
``` | ||
|
||
Please make sure that you have the necessary permissions to execute the script. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
|
||
set -eu | ||
|
||
# Run this from the root of the repository | ||
if ! test -d scripts | ||
then | ||
echo "Must run from the root of the repository" | ||
exit 1 | ||
fi | ||
|
||
DO_BUILD="False" | ||
BUILD_ONLY="False" | ||
while [[ "${1:-}" != "" ]]; do | ||
case $1 in | ||
-h|--help) | ||
echo "Usage: run_sudo_tests.sh [--build]" | ||
exit 1 | ||
;; | ||
--build) | ||
DO_BUILD="True" | ||
;; | ||
--build-only) | ||
BUILD_ONLY="True" | ||
;; | ||
*) | ||
echo "Unrecognized parameter: $1" | ||
exit 1 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
# Copying the dist/ dir can cause permission issues, so just nuke it. | ||
hatch clean 2> /dev/null || true | ||
|
||
ARGS="" | ||
|
||
if test "${PIP_INDEX_URL:-}" != ""; then | ||
# If PIP_INDEX_URL is set, then export that in to the container | ||
# so that `pip install` run in the container will fetch packages | ||
# from the correct repository. | ||
ARGS="${ARGS} -e PIP_INDEX_URL=${PIP_INDEX_URL}" | ||
fi | ||
|
||
ARGS="${ARGS} -h localuser.environment.internal" | ||
CONTAINER_IMAGE_TAG="job_attachment_localuser_test" | ||
CONTAINER_IMAGE_DIR="localuser_sudo_environment" | ||
|
||
if test "${DO_BUILD}" == "True"; then | ||
docker build testing_containers/"${CONTAINER_IMAGE_DIR}" -t "${CONTAINER_IMAGE_TAG}" | ||
fi | ||
|
||
if test "${BUILD_ONLY}" == "True"; then | ||
exit 0 | ||
fi | ||
|
||
docker run --name test_sudo --rm -v $(pwd):/code:ro ${ARGS} "${CONTAINER_IMAGE_TAG}":latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.