Skip to content

Commit

Permalink
Merge pull request #235 from chgeuer/chgeuer/chmod
Browse files Browse the repository at this point in the history
Remove all `chmod` calls. Fix typos. TenantIDs don't have to be GUIDs.
  • Loading branch information
1iveowl committed Aug 25, 2023
2 parents 512e2f0 + 51cb42c commit 7782fb1
Show file tree
Hide file tree
Showing 78 changed files with 14 additions and 143 deletions.
6 changes: 3 additions & 3 deletions docs/design-decisions.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Use of Down.Guard
Simplify writing guard clauses and make sure they are handled consistantly.
Dawnhttps://github.com/safakgur/guard
## Use of `Down.Guard`

- Simplify writing guard clauses and make sure they are handled consistently. https://github.com/safakgur/guard
5 changes: 2 additions & 3 deletions src/Saas.Admin/Saas.Admin.Client/OAuthBaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ private async Task<string> GetAccessToken(CancellationToken ct)

return accessToken;
}
catch (MsalUiRequiredException ex)
catch (MsalUiRequiredException)
{
throw;
}
catch (Exception ex)
catch (Exception)
{

throw;
}
}
Expand Down
Empty file modified src/Saas.Admin/deployment/act/clean.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Admin/deployment/act/deploy.sh
100644 → 100755
Empty file.
2 changes: 0 additions & 2 deletions src/Saas.Admin/deployment/act/setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ echo "Settings execute permissions on necessary scripts files."

sudo mkdir -p "${ACT_SECRETS_DIR}"

sudo chmod +x ${ACT_DIR}/*.sh
sudo chmod +x ${SCRIPT_DIR}/*.sh >/dev/null 2>&1
sudo touch ${ACT_SECRETS_FILE}
sudo chown "${USER}" ${ACT_SECRETS_FILE}
sudo touch ${ACT_SECRETS_FILE_RG}
Expand Down
Empty file modified src/Saas.Admin/deployment/build.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Admin/deployment/constants.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Admin/deployment/run.sh
100644 → 100755
Empty file.
Empty file.
19 changes: 0 additions & 19 deletions src/Saas.Admin/deployment/setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@
source "./constants.sh"

echo "Setting up the deployment environment."
echo "Settings execute permissions on necessary scripts files."

(
sudo chmod +x ./*.sh
sudo chmod +x ./script/*.sh >/dev/null 2>&1
sudo chmod +x ./script/*.py
sudo chmod +x "${SHARED_MODULE_DIR}"/*.sh
sudo chmod +x "${SHARED_MODULE_DIR}"/*.py
) ||
{
echo "Failed to set execute permissions on the necessary scripts."
exit 1
}

repo_base="$(git rev-parse --show-toplevel)" ||
{
Expand All @@ -27,12 +14,6 @@ repo_base="$(git rev-parse --show-toplevel)" ||
docker_file_folder="${repo_base}/src/Saas.Lib/Deployment.Container"

# redirect to build.sh in the Deployment.Container folder
sudo chmod +x "${docker_file_folder}/build.sh" ||
{
echo "Failed to set execute permissions on the 'build.sh' script."
exit 1
}

echo "Building the deployment container."
./build.sh ||
{
Expand Down
Empty file modified src/Saas.Admin/deployment/start.sh
100644 → 100755
Empty file.
1 change: 0 additions & 1 deletion src/Saas.Admin/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Provisioning is easy:
2. Run these commands:

```bash
sudo chmod +x setup.sh
./setup.sh
./run.sh
```
Expand Down
1 change: 0 additions & 1 deletion src/Saas.Application/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Provisioning is easy:
2. Run these commands:

```bash
sudo chmod +x setup.sh
./setup.sh
./run.sh
```
Expand Down
Empty file modified src/Saas.Application/deployment/act/clean.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Application/deployment/act/deploy.sh
100644 → 100755
Empty file.
3 changes: 0 additions & 3 deletions src/Saas.Application/deployment/act/setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ echo "Setting up the SaaS Signup Administration Web App Act deployment environme
echo "Settings execute permissions on necessary scripts files."

sudo mkdir -p "${ACT_SECRETS_DIR}"

sudo chmod +x ${ACT_DIR}/*.sh
sudo chmod +x ${SCRIPT_DIR}/*.sh >/dev/null 2>&1
sudo touch ${ACT_SECRETS_FILE}
sudo chown "${USER}" ${ACT_SECRETS_FILE}
sudo touch ${ACT_SECRETS_FILE_RG}
Expand Down
Empty file modified src/Saas.Application/deployment/build.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Application/deployment/constants.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Application/deployment/run.sh
100644 → 100755
Empty file.
Empty file.
19 changes: 0 additions & 19 deletions src/Saas.Application/deployment/setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@
source "./constants.sh"

echo "Setting up the deployment environment."
echo "Settings execute permissions on necessary scripts files."

(
sudo chmod +x ./*.sh
sudo chmod +x ./script/*.sh >/dev/null 2>&1
sudo chmod +x ./script/*.py
sudo chmod +x "${SHARED_MODULE_DIR}"/*.sh
sudo chmod +x "${SHARED_MODULE_DIR}"/*.py
) ||
{
echo "Failed to set execute permissions on the necessary scripts."
exit 1
}

repo_base="$(git rev-parse --show-toplevel)" ||
{
Expand All @@ -27,12 +14,6 @@ repo_base="$(git rev-parse --show-toplevel)" ||
docker_file_folder="${repo_base}/src/Saas.Lib/Deployment.Container"

# redirect to build.sh in the Deployment.Container folder
sudo chmod +x "${docker_file_folder}/build.sh" ||
{
echo "Failed to set execute permissions on the 'build.sh' script."
exit 1
}

echo "Building the deployment container."
./build.sh ||
{
Expand Down
Empty file modified src/Saas.Application/deployment/start.sh
100644 → 100755
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function check-settings() {

(
is-guid ".initConfig.subscriptionId" 1>/dev/null &&
is-guid ".initConfig.tenantId" 1>/dev/null &&
value-exist ".initConfig.naming.solutionName" 1>/dev/null &&
value-exist ".initConfig.naming.solutionPrefix" 1>/dev/null &&
is-valid-b2c-location ".initConfig.azureb2c.location" 1>/dev/null &&
Expand Down
12 changes: 0 additions & 12 deletions src/Saas.Identity/Saas.IdentityProvider/deployment/script/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,6 @@ function check-prerequisites() {
fi
}

function initialize-shell-scripts() {
# if not running in a container
if ! [ -f /.dockerenv ]; then
# ensure the needed scripts are executable
sudo chmod +x ${SCRIPT_DIR}/*.sh
sudo chmod +x ${SHARED_MODULE_DIR}/*.py
fi
}

function initialize-configuration-manifest-file() {

if [[ ! -s "${CONFIG_FILE}" || ! -f "${CONFIG_FILE}" ]]; then
Expand Down Expand Up @@ -147,9 +138,6 @@ function initialize-configuration-manifest-file() {
# check if prerequisites for running the deployment script are met
check-prerequisites

# initialize shell scripts ensuring that permissions are set correctly
initialize-shell-scripts

# initialize configuration manifest file
initialize-configuration-manifest-file

Expand Down
16 changes: 0 additions & 16 deletions src/Saas.Identity/Saas.IdentityProvider/deployment/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@
source "./constants.sh"

echo "Setting up the deployment environment."
echo "Settings execute permissions on necessary scripts files."

(
sudo chmod +x ./*.sh || exit 1
sudo chmod +x ./script/*.sh || exit 1
sudo chmod +x ./script/*.py || exit 1
) ||
{
echo "Failed to set execute permissions on the necessary scripts."
exit 1
}

repo_base="$(git rev-parse --show-toplevel)" ||
{
Expand All @@ -25,11 +14,6 @@ repo_base="$(git rev-parse --show-toplevel)" ||
docker_file_folder="${repo_base}/src/Saas.Lib/Deployment.Container"

# redirect to build.sh in the Deployment.Container folder
sudo chmod +x "${docker_file_folder}/build.sh" ||
{
echo "Failed to set execute permissions on the 'build.sh' script."
exit 1
}

echo "Building the deployment container."
./build.sh ||
Expand Down
6 changes: 0 additions & 6 deletions src/Saas.Identity/Saas.IdentityProvider/deployment/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ sudo echo "You are logged in with sudo." |
echo-color \
--level success

# if not running in a container
if ! [ -f /.dockerenv ]; then
# make sure that the init script is executable
chmod +x "$SCRIPT_DIR/init.sh"
fi

# initialize deployment environment
"${SCRIPT_DIR}/init.sh" ||
if [[ $? -eq 2 ]]; then exit 0; fi
Expand Down
19 changes: 9 additions & 10 deletions src/Saas.Identity/Saas.IdentityProvider/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This deployment script provisions and configures the Azure services defining the

Before you begin, you should [fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this GitHub repository to you own GitHub account to make it your own.

> Tip: Sign up to GitHub for free: [join](github.com/join).
> Tip: Sign up to GitHub for free: [join](https://github.com/join).
### Purpose

Expand Down Expand Up @@ -56,10 +56,10 @@ No matter the operating system you're using, you will need these tools to be ins
To begin, please open your GNU Linux terminal to the directory where you've [cloned](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) the [forked](https://docs.github.com/en/get-started/quickstart/fork-a-repo) version of ASDK. Should be something like:

````bash
.../src/Saas.Identity/Saas.IdentityProvider/deployment
cd src/Saas.Identity/Saas.IdentityProvider/deployment
````

![image-20230110094801956](.assets/readme/image-20230110094801956-1683889385775-1.png)
![Screenshot of a Linux console window](.assets/readme/image-20230110094801956-1683889385775-1.png)

> *Tip #1*: If you are on a Windows 10/11 PC and need to access your cloned Git repository one of your local drives, from the WSL Terminal, you can find the drives in the *`mnt`* directory - e.g., like this `cd /mnt/d/<path on d-drive>`.
>
Expand All @@ -82,11 +82,10 @@ az login --scope "https://graph.microsoft.com/.default"
To run the script you must first setup of the deployment environment and build the container. To do this, run the following commands:

```bash
chmod +x setup.sh # only needed the first time to set execute permissions on setup.sh
./setup.sh
```

![image-20230221115203497](.assets/readme/image-20230221115203497-1683889385776-2.png)
![Screenshot of a Linux console window after initial setup.sh execution](.assets/readme/image-20230221115203497-1683889385776-2.png)

This will take a few minutes to complete and you will only need to do it once. The container will be named `asdk-script-deployment`.

Expand All @@ -102,7 +101,7 @@ When the container build have completed, run the script with the following comma
./run.sh
```

![image-20230221115249541](.assets/readme/image-20230221115249541-1683889385776-3.png)
![Screenshot of a Linux console window after initial run.sh execution](.assets/readme/image-20230221115249541-1683889385776-3.png)

This will instantiate the container and mount the current root directory as a number of volumes (i.e., directories) that will become accessible from within the container.

Expand Down Expand Up @@ -157,12 +156,12 @@ You may have multiple Azure subscriptions and thus manually choosing which subsc
Alternatively, get to list of your subscriptions of the tenant that you are logged into by running this az cli command:

```bash
az account subscription list --query "[].{DisplayName:displayName, Id:id}" --output table
az account subscription list --query "[].{DisplayName:displayName, Id:id}" --output table
```

### Tenant Id

Get the `tenantId`by running the following command:
Get the `tenantId` by running the following command:

```bash
az account show --query tenantId
Expand Down Expand Up @@ -193,7 +192,7 @@ Other values in `initConfig`:

### Running the script

After you've added the values outlined above, to `config.json`, you're ready to run the script again.
After you've added the values outlined above, to `config.json`, you're ready to run the `run.sh` script again.

While running the script the second time, you will be asked to log in once, and maybe twice.

Expand Down Expand Up @@ -233,7 +232,7 @@ The deployment script has run to it's completion and the Identity Framework have

The Identity Framework is gathered in an Azure Resource group. In the Azure Portal it will look something like this:

![image-20230221121152035](.assets/readme/image-20230221121152035-1683889385777-4.png)
![Screenshot showing the resource group contents](.assets/readme/image-20230221121152035-1683889385777-4.png)

### Adding the Other Modules

Expand Down
Empty file modified src/Saas.Identity/Saas.Permissions/deployment/act/clean.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Identity/Saas.Permissions/deployment/act/deploy.sh
100644 → 100755
Empty file.
2 changes: 0 additions & 2 deletions src/Saas.Identity/Saas.Permissions/deployment/act/setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ echo "Settings execute permissions on necessary scripts files."

sudo mkdir -p "${ACT_SECRETS_DIR}"

sudo chmod +x ${ACT_DIR}/*.sh
sudo chmod +x ${SCRIPT_DIR}/*.sh >/dev/null 2>&1
sudo touch ${ACT_SECRETS_FILE}
sudo chown "${USER}" ${ACT_SECRETS_FILE}
sudo touch ${ACT_SECRETS_FILE_RG}
Expand Down
Empty file modified src/Saas.Identity/Saas.Permissions/deployment/build.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Identity/Saas.Permissions/deployment/constants.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Identity/Saas.Permissions/deployment/run.sh
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
20 changes: 0 additions & 20 deletions src/Saas.Identity/Saas.Permissions/deployment/setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,9 @@
source "./constants.sh"

echo "Setting up the deployment environment."
echo "Settings execute permissions on necessary scripts files."

echo "${SHARED_MODULE_DIR}"

(
sudo chmod +x ./*.sh
sudo chmod +x ./script/*.sh >/dev/null 2>&1
sudo chmod +x ./script/*.py
sudo chmod +x "${SHARED_MODULE_DIR}"/*.sh
sudo chmod +x "${SHARED_MODULE_DIR}"/*.py
) ||
{
echo "Failed to set execute permissions on the necessary scripts."
exit 1
}

repo_base="$(git rev-parse --show-toplevel)" ||
{
echo "Failed to get the root of the repository."
Expand All @@ -28,13 +15,6 @@ repo_base="$(git rev-parse --show-toplevel)" ||

docker_file_folder="${repo_base}/src/Saas.Lib/Deployment.Container"

# redirect to build.sh in the Deployment.Container folder
sudo chmod +x "${docker_file_folder}/build.sh" ||
{
echo "Failed to set execute permissions on the 'build.sh' script."
exit 1
}

echo "Building the deployment container."
./build.sh ||
{
Expand Down
Empty file modified src/Saas.Identity/Saas.Permissions/deployment/start.sh
100644 → 100755
Empty file.
3 changes: 0 additions & 3 deletions src/Saas.Identity/Saas.Permissions/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Provisioning is an easy two step process:

2. Run these commands:
```bash
sudo chmod +x setup.sh
./setup.sh
./run.sh
```
Expand Down Expand Up @@ -174,7 +173,6 @@ Here are the steps to set things up for deploying the SaaS Permissions Service A
2. From the directory, run these commands and bash shell scripts:
```bash
sudo chmod +c ./setup.sh
./setup.sh
./run.sh
```
Expand Down Expand Up @@ -239,7 +237,6 @@ Here are the steps for getting up and running with Act for doing local deploymen
2. Set up but running the command:

```bash
chmod +x ./setup.sh
./setup.sh
```

Expand Down
Empty file modified src/Saas.Lib/Act.Container/build.sh
100644 → 100755
Empty file.
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/app-reg-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/app-service-constants.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/backup-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/clean-credentials.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/colors-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/config-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/deploy-app-service.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/deploy-config-entries.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/deploy-debug.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/deploy-service-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/github-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/key-vault-module.sh
100644 → 100755
Empty file.
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/log-module.sh
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/oidc-workflow-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/patch-github-workflow.py
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/policy-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/resource-module.sh
100644 → 100755
Empty file.
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/storage-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/tenant-login-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/user-module.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.Lib/Deployment.Script.Modules/util-module.sh
100644 → 100755
Empty file.
1 change: 0 additions & 1 deletion src/Saas.SignupAdministration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Provisioning is easy:
2. Run these commands:

```bash
sudo chmod +x setup.sh
./setup.sh
./run.sh
```
Expand Down
Empty file modified src/Saas.SignupAdministration/deployment/act/clean.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.SignupAdministration/deployment/act/deploy.sh
100644 → 100755
Empty file.
3 changes: 0 additions & 3 deletions src/Saas.SignupAdministration/deployment/act/setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ done
source "../constants.sh"

echo "Setting up the SaaS Signup Administration Web App Act deployment environment."
echo "Settings execute permissions on necessary scripts files."

sudo mkdir -p "${ACT_SECRETS_DIR}"

sudo chmod +x ${ACT_DIR}/*.sh
sudo chmod +x ${SCRIPT_DIR}/*.sh >/dev/null 2>&1
sudo touch ${ACT_SECRETS_FILE}
sudo chown "${USER}" ${ACT_SECRETS_FILE}
sudo touch ${ACT_SECRETS_FILE_RG}
Expand Down
Empty file modified src/Saas.SignupAdministration/deployment/build.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.SignupAdministration/deployment/constants.sh
100644 → 100755
Empty file.
Empty file modified src/Saas.SignupAdministration/deployment/run.sh
100644 → 100755
Empty file.
Empty file.
Loading

0 comments on commit 7782fb1

Please sign in to comment.