-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update docker login action * update docker login action * update docker login action * update docker login action * update docker login action * update docker login action * update docker login action * update az login credentials * change to registry * update ID token permission * azure location parameter * changes in aci deployment workflow * update storage container script * changes to create rg, storage, akv * check for resource group and create if that does not exist * clean up resource in resource group * add build and test workflow file * change to ci-build file * change to ci-build file * change to ci-build file * change to ci-build file * changes to ci-build.yml * changes to ci-build.yml * changes to ci-build.yml * changes to ci-build.yml * env variable changes * change to ci-build.yml * revert changes * ci-build changes * change trigger to push to test * add container image build * add container image build * test with complete local build * add README file * README update, add pull request trigger for ci-build file
- Loading branch information
Showing
7 changed files
with
244 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# CI Workflows | ||
|
||
This repository contains several CI workflows designed for deployment in a self-hosted runner. Below is a description of each workflow and its purpose. | ||
|
||
## Workflows | ||
|
||
### `ci-build.yml` | ||
**Trigger:** Automatically on every pull request or Manually | ||
|
||
- Builds the `depa-training-encfs`, `depa-training`, and other containers required for the COVID scenario. | ||
- Runs containers locally to perform preprocessing, save the model, and train the model. | ||
|
||
### `ci.yml` | ||
**Trigger:** Manually | ||
|
||
- Prepares data and model for deployment. | ||
- Creates Azure Storage and Key Vault if they do not already exist. | ||
- Imports data and model encryption keys with key release policies. | ||
- Encrypts the data and model. | ||
- Uploads the encrypted data and model to Azure Storage. | ||
- Deploys CCR on Azure Container Instances (ACI) and trains the model. | ||
|
||
### `ci-local.yml` | ||
**Trigger:** Manually | ||
|
||
- Pulls containers from Azure Container Registry (ACR). | ||
- Runs containers locally to perform preprocessing, save the model, and train the model. | ||
|
||
### `release.yml` | ||
**Trigger:** Release Event | ||
|
||
- Builds the `depa-training-encfs`, `depa-training`, contract service container, and other containers required for the COVID scenario. | ||
- Pushes the built containers to ACR. | ||
|
||
### `contract-service.yml` | ||
**Trigger:** Manually | ||
|
||
- Builds the contract service container. | ||
- Deploys the contract service. | ||
|
||
## Steps to Deploy Self-Hosted Runner | ||
|
||
1. **Set up Recommended OIDC Authentication:** | ||
- Follow the [official guide](https://learn.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=openid%2Cpython%2Caspnetcore#set-up-a-github-actions-workflow-manually) to authenticate GitHub Actions with Azure services using the OIDC approach. | ||
|
||
2. **Assign Necessary Permissions:** | ||
- For the service principal created during the above step (or an external one), assign the following permissions: | ||
- Contributor | ||
- Custom role with `Microsoft.Authorization/GetRoleAssignment` and `Microsoft.Authorization/CreateRoleAssignment` | ||
|
||
3. **Create a New Self-Hosted Runner:** | ||
- Navigate to `Settings` > `Actions` > `Runners` in your GitHub repository. | ||
- Create a "New self-hosted Runner". | ||
|
||
4. **Set Up the Azure VM:** | ||
- Create an Azure VM with at least 16GB RAM, 4 CPUs, and 128GB SSD. | ||
- Follow the instructions provided in the self-hosted runner setup to configure the action runner on your Azure VM. | ||
|
||
--- | ||
|
||
By following these instructions, you can set up and utilize the CI workflows in your self-hosted runner to automate and manage the deployment processes for your projects. | ||
|
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,60 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# GitHub recommends pinning actions to a commit SHA. | ||
# To get a newer version, you will need to update the SHA. | ||
# You can also reference a tag or branch, but the action may change without warning. | ||
|
||
name: Build and Test Images | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-test-image: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Update submodules | ||
run: git submodule update --init --recursive | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.19.x' | ||
|
||
- name: Install jq | ||
run: sudo apt install -y jq | ||
|
||
- name: Install make | ||
run: sudo apt install make | ||
|
||
- name: Install wheel | ||
run: pip install wheel | ||
|
||
- name: Build encrypted filesystem artifacta, contract ledger client & depa-training container | ||
run: ci/build.sh | ||
|
||
- name: Build container images | ||
run: cd ${{ github.workspace }}/scenarios/covid && ./ci/build.sh | ||
|
||
- name: Run pre-processing | ||
run: cd ./scenarios/covid/deployment/docker && ./preprocess.sh | ||
|
||
- name: Run model saving | ||
run: cd ./scenarios/covid/deployment/docker && ./save-model.sh | ||
|
||
- name: Run training | ||
run: cd ./scenarios/covid/deployment/docker && ./train.sh | ||
|
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 |
---|---|---|
@@ -1,34 +1,66 @@ | ||
#!/bin/bash | ||
# | ||
echo "Checking if resource group $AZURE_RESOURCE_GROUP exists..." | ||
RG_EXISTS=$(az group exists --name $AZURE_RESOURCE_GROUP) | ||
|
||
az group create \ | ||
--location westeurope \ | ||
--name $AZURE_RESOURCE_GROUP | ||
|
||
az storage account create \ | ||
--resource-group $AZURE_RESOURCE_GROUP \ | ||
--name $AZURE_STORAGE_ACCOUNT_NAME | ||
|
||
az storage container create \ | ||
--resource-group $AZURE_RESOURCE_GROUP \ | ||
--account-name $AZURE_STORAGE_ACCOUNT_NAME \ | ||
--name $AZURE_ICMR_CONTAINER_NAME | ||
|
||
az storage container create \ | ||
--resource-group $AZURE_RESOURCE_GROUP \ | ||
--account-name $AZURE_STORAGE_ACCOUNT_NAME \ | ||
--name $AZURE_COWIN_CONTAINER_NAME | ||
|
||
az storage container create \ | ||
--resource-group $AZURE_RESOURCE_GROUP \ | ||
--account-name $AZURE_STORAGE_ACCOUNT_NAME \ | ||
--name $AZURE_INDEX_CONTAINER_NAME | ||
|
||
az storage container create \ | ||
--resource-group $AZURE_RESOURCE_GROUP \ | ||
--account-name $AZURE_STORAGE_ACCOUNT_NAME \ | ||
--name $AZURE_MODEL_CONTAINER_NAME | ||
|
||
az storage container create \ | ||
--resource-group $AZURE_RESOURCE_GROUP \ | ||
--account-name $AZURE_STORAGE_ACCOUNT_NAME \ | ||
--name $AZURE_OUTPUT_CONTAINER_NAME | ||
if [ "$RG_EXISTS" == "false" ]; then | ||
echo "Resource group $AZURE_RESOURCE_GROUP does not exist. Creating it now..." | ||
# Create the resource group | ||
az group create --name $AZURE_RESOURCE_GROUP --location $AZURE_LOCATION | ||
else | ||
echo "Resource group $AZURE_RESOURCE_GROUP already exists. Skipping creation." | ||
fi | ||
|
||
#echo "Check if storage account $STORAGE_ACCOUNT_NAME exists..." | ||
STORAGE_ACCOUNT_EXISTS=$(az storage account check-name --name $AZURE_STORAGE_ACCOUNT_NAME --query "nameAvailable" --output tsv) | ||
|
||
if [ "$STORAGE_ACCOUNT_EXISTS" == "true" ]; then | ||
echo "Storage account $AZURE_STORAGE_ACCOUNT_NAME does not exist. Creating it now..." | ||
az storage account create --resource-group $AZURE_RESOURCE_GROUP --name $AZURE_STORAGE_ACCOUNT_NAME | ||
else | ||
echo "Storage account $AZURE_STORAGE_ACCOUNT_NAME exists" | ||
fi | ||
|
||
# Get the storage account key | ||
ACCOUNT_KEY=$(az storage account keys list --resource-group $AZURE_RESOURCE_GROUP --account-name $AZURE_STORAGE_ACCOUNT_NAME --query "[0].value" --output tsv) | ||
|
||
|
||
# Check if the ICMR container exists | ||
CONTAINER_EXISTS=$(az storage container exists --name $AZURE_ICMR_CONTAINER_NAME --account-name $AZURE_STORAGE_ACCOUNT_NAME --account-key $ACCOUNT_KEY --query "exists" --output tsv) | ||
|
||
if [ "$CONTAINER_EXISTS" == "false" ]; then | ||
echo "Container $AZURE_ICMR_CONTAINER_NAME does not exist. Creating it now..." | ||
az storage container create --resource-group $AZURE_RESOURCE_GROUP --account-name $AZURE_STORAGE_ACCOUNT_NAME --name $AZURE_ICMR_CONTAINER_NAME --account-key $ACCOUNT_KEY | ||
fi | ||
|
||
# Check if the COWIN container exists | ||
CONTAINER_EXISTS=$(az storage container exists --name $AZURE_COWIN_CONTAINER_NAME --account-name $AZURE_STORAGE_ACCOUNT_NAME --account-key $ACCOUNT_KEY --query "exists" --output tsv) | ||
|
||
if [ "$CONTAINER_EXISTS" == "false" ]; then | ||
echo "Container $AZURE_COWIN_CONTAINER_NAME does not exist. Creating it now..." | ||
az storage container create --resource-group $AZURE_RESOURCE_GROUP --account-name $AZURE_STORAGE_ACCOUNT_NAME --name $AZURE_COWIN_CONTAINER_NAME --account-key $ACCOUNT_KEY | ||
fi | ||
|
||
# Check if the INDEX container exists | ||
CONTAINER_EXISTS=$(az storage container exists --name $AZURE_INDEX_CONTAINER_NAME --account-name $AZURE_STORAGE_ACCOUNT_NAME --account-key $ACCOUNT_KEY --query "exists" --output tsv) | ||
|
||
if [ "$CONTAINER_EXISTS" == "false" ]; then | ||
echo "Container $AZURE_INDEX_CONTAINER_NAME does not exist. Creating it now..." | ||
az storage container create --resource-group $AZURE_RESOURCE_GROUP --account-name $AZURE_STORAGE_ACCOUNT_NAME --name $AZURE_INDEX_CONTAINER_NAME --account-key $ACCOUNT_KEY | ||
fi | ||
|
||
# Check if the MODEL container exists | ||
CONTAINER_EXISTS=$(az storage container exists --name $AZURE_MODEL_CONTAINER_NAME --account-name $AZURE_STORAGE_ACCOUNT_NAME --account-key $ACCOUNT_KEY --query "exists" --output tsv) | ||
|
||
if [ "$CONTAINER_EXISTS" == "false" ]; then | ||
echo "Container $AZURE_MODEL_CONTAINER_NAME does not exist. Creating it now..." | ||
az storage container create --resource-group $AZURE_RESOURCE_GROUP --account-name $AZURE_STORAGE_ACCOUNT_NAME --name $AZURE_MODEL_CONTAINER_NAME --account-key $ACCOUNT_KEY | ||
fi | ||
|
||
# Check if the OUTPUT container exists | ||
CONTAINER_EXISTS=$(az storage container exists --name $AZURE_OUTPUT_CONTAINER_NAME --account-name $AZURE_STORAGE_ACCOUNT_NAME --account-key $ACCOUNT_KEY --query "exists" --output tsv) | ||
|
||
if [ "$CONTAINER_EXISTS" == "false" ]; then | ||
echo "Container $AZURE_OUTPUT_CONTAINER_NAME does not exist. Creating it now..." | ||
az storage container create --resource-group $AZURE_RESOURCE_GROUP --account-name $AZURE_STORAGE_ACCOUNT_NAME --name $AZURE_OUTPUT_CONTAINER_NAME --account-key $ACCOUNT_KEY | ||
fi |
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