Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding AttachDataDiskLinuxVM scenario and base code #169

Draft
wants to merge 46 commits into
base: vmss
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
585633b
[update] authentication for the pipeline.
vmarcella Dec 19, 2023
0908b36
[update] pipeline environment for allowing any branch to run the scen…
vmarcella Dec 19, 2023
4f687a2
[add] comment around the environment addition.
vmarcella Dec 19, 2023
4335e88
[update] environment name.
vmarcella Dec 19, 2023
897dcd2
VMSS Scanerio update
belginceran Nov 23, 2023
3a41e28
VMSS Scanerio update
belginceran Nov 23, 2023
604f032
VMSS updates
belginceran Dec 4, 2023
d8486a1
VMSS updates
belginceran Dec 4, 2023
cdf50c0
VMSS updates
belginceran Dec 4, 2023
4ce12f9
VMSS update
belginceran Dec 5, 2023
727f7b2
VMSS update
belginceran Dec 5, 2023
b8911d7
VMSS update
belginceran Dec 5, 2023
3ea4d2a
VMSS update
belginceran Dec 5, 2023
df5506f
VMSS updates
belginceran Dec 5, 2023
02dc8cd
VMSS Updates
belginceran Dec 14, 2023
0acffa9
VMSS updates
belginceran Dec 14, 2023
17763b3
VMSS updates
belginceran Dec 14, 2023
74e563e
VMSS updates
belginceran Dec 14, 2023
71074ef
VMSS updates
belginceran Dec 18, 2023
7fab75d
update
belginceran Dec 18, 2023
f6e6f55
updated
belginceran Dec 18, 2023
64906c9
VMSS updates
belginceran Dec 19, 2023
bea8c3a
VMSS updates
belginceran Dec 19, 2023
5ae2536
VMSS updates
belginceran Dec 19, 2023
f465e74
VMSS updates
belginceran Dec 19, 2023
f02ec22
VMSS updates
belginceran Dec 19, 2023
4db8e03
Update README.md
naman-msft Dec 21, 2023
2f3787d
Update README.md
naman-msft Dec 21, 2023
3e82687
Update README.md
naman-msft Dec 21, 2023
3db495f
Update README.md
naman-msft Dec 21, 2023
82dbad0
[add] test upstream scenarios (#162)
rguptar Jan 3, 2024
a38bb66
Update install_from_release.sh to account for localized files
mbifeld Dec 22, 2023
21e8b4a
Update install_from_release.sh
mbifeld Dec 23, 2023
8715d5e
Update install_from_release.sh
mbifeld Dec 23, 2023
7fac854
Update install_from_release.sh
mbifeld Dec 23, 2023
7b52a85
Update install_from_release.sh
mbifeld Dec 23, 2023
3b20d76
Update install_from_release.sh
mbifeld Dec 23, 2023
ff98988
Update install_from_release.sh
mbifeld Dec 23, 2023
7a83870
Update install_from_release.sh
mbifeld Dec 23, 2023
819b787
Empty parameter grabs the scenarios from IE
mbifeld Dec 28, 2023
6fdaa21
Update install_from_release.sh
mbifeld Dec 28, 2023
ee7aaf4
Updated variable declariations
Jan 3, 2024
5f17eda
Switched lang to LANG
Jan 3, 2024
60caf59
Update locale variable to not incorrectly set a default of ''. (#166)
vmarcella Jan 25, 2024
4ea215b
Adding AttachDataDiskLinuxVM scenario.
brmoreir Jan 30, 2024
6c4feb0
Updating DataDisk_VM
brmoreir Jan 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/scenario-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,36 @@ on:
branches:
- main
workflow_dispatch:

permissions:
id-token: write
contents: read
jobs:
test-ocd-scenarios:
runs-on: ubuntu-latest
# This is needed in order to obtain OIDC tokens to sign this pipeline into
# the testing subscription for any branch in this repository.
environment: ScenarioTesting
steps:
- uses: actions/checkout@v2
- name: Build all targets.
run: |
make build-all
make test-all
- name: Sign into Azure
uses: azure/actions/login@v1
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }}
- name: Run all one click deployment scenarios.
uses: azure/CLI@v1
if: github.event_name != 'pull_request'
with:
azcliversion: 2.53.0
inlineScript: |
apk add --no-cache make
make test-scenarios SUBSCRIPTION=${{ secrets.AZURE_SUBSCRIPTION }}
apk add --no-cache make git openssh openssl helm curl jq
make test-upstream-scenarios SUBSCRIPTION=${{ secrets.AZURE_SUBSCRIPTION }}
- name: Display ie.log file
if: github.event_name != 'pull_request'
if: (success() || failure()) && github.event_name != 'pull_request'
run: |
cat ie.log
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "upstream-scenarios"]
path = upstream-scenarios
url = https://github.com/MicrosoftDocs/executable-docs
20 changes: 18 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,30 @@ test-all:

SUBSCRIPTION ?= 00000000-0000-0000-0000-000000000000
SCENARIO ?= ./README.md
WORKING_DIRECTORY ?= $(PWD)
test-scenario:
@echo "Running scenario $(SCENARIO)"
$(IE_BINARY) test $(SCENARIO) --subscription $(SUBSCRIPTION)
$(IE_BINARY) test $(SCENARIO) --subscription $(SUBSCRIPTION) --working-directory $(WORKING_DIRECTORY)

test-scenarios:
@echo "Testing out the scenarios"
for dir in ./scenarios/ocd/*/; do \
$(MAKE) test-scenario SCENARIO="$${dir}README.md" SUBCRIPTION="$(SUBSCRIPTION)"; \
($(MAKE) test-scenario SCENARIO="$${dir}README.md" SUBCRIPTION="$(SUBSCRIPTION)") || exit $$?; \
done

test-upstream-scenarios:
@echo "Pulling the upstream scenarios"
@git config --global --add safe.directory /home/runner/work/InnovationEngine/InnovationEngine
@git submodule update --init --recursive
@echo "Testing out the upstream scenarios"
for dir in ./upstream-scenarios/scenarios/*/; do \
if ! [ -f $${dir}README.md ]; then \
continue; \
fi; \
if echo "$${dir}" | grep -q "CreateContainerAppDeploymentFromSource"; then \
continue; \
fi; \
($(MAKE) test-scenario SCENARIO="$${dir}README.md" SUBCRIPTION="$(SUBSCRIPTION)" WORKING_DIRECTORY="$${dir}") || exit $$?; \
done

# ------------------------------- Run targets ----------------------------------
Expand Down
2 changes: 1 addition & 1 deletion cmd/ie/commands/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ var executeCommand = &cobra.Command{
err = innovationEngine.ExecuteScenario(scenario)
if err != nil {
logging.GlobalLogger.Errorf("Error executing scenario: %s", err)
fmt.Printf("Error executing scenario: %s", err)
fmt.Printf("Error executing scenario: %s\n", err)
os.Exit(1)
}
},
Expand Down
20 changes: 14 additions & 6 deletions cmd/ie/commands/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ func init() {
Bool("verbose", false, "Enable verbose logging & standard output.")
testCommand.PersistentFlags().
String("subscription", "", "Sets the subscription ID used by a scenarios azure-cli commands. Will rely on the default subscription if not set.")
testCommand.PersistentFlags().
String("working-directory", ".", "Sets the working directory for innovation engine to operate out of. Restores the current working directory when finished.")
}

var testCommand = &cobra.Command{
Expand All @@ -32,12 +34,14 @@ var testCommand = &cobra.Command{

verbose, _ := cmd.Flags().GetBool("verbose")
subscription, _ := cmd.Flags().GetString("subscription")
workingDirectory, _ := cmd.Flags().GetString("working-directory")

innovationEngine, err := engine.NewEngine(engine.EngineConfiguration{
Verbose: verbose,
DoNotDelete: false,
Subscription: subscription,
CorrelationId: "",
Verbose: verbose,
DoNotDelete: false,
Subscription: subscription,
CorrelationId: "",
WorkingDirectory: workingDirectory,
})

if err != nil {
Expand All @@ -57,7 +61,11 @@ var testCommand = &cobra.Command{
os.Exit(1)
}

innovationEngine.TestScenario(scenario)

err = innovationEngine.TestScenario(scenario)
if err != nil {
logging.GlobalLogger.Errorf("Error testing scenario: %s", err)
fmt.Printf("Error testing scenario: %s\n", err)
os.Exit(1)
}
},
}
89 changes: 89 additions & 0 deletions scenarios/ocd/AttachDataDiskLinuxVM/DataDisk_VM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
az login
az account set --subscription "XXXXXXX"
az account show

#VARIABLE DECLARATION
export NETWORK_PREFIX="$(($RANDOM % 254 + 1))"
export RANDOM_ID="$(openssl rand -hex 3)"
export MY_RESOURCE_GROUP_NAME="myResourceGroup$RANDOM_ID"
export REGION="eastus"
export MY_VM_NAME="myVMName$RANDOM_ID"
export MY_VM_IMAGE='Ubuntu2204'
export MY_VM_USERNAME="azureuser"
export MY_VM_SIZE='Standard_DS2_v5'
export MY_VNET_NAME="myVNet$RANDOM_ID"
export MY_VNET_PREFIX="10.$NETWORK_PREFIX.0.0/16"
export MY_VM_NIC_NAME="myVMNicName$RANDOM_ID"
export MY_SN_NAME="mySN$RANDOM_ID"
export MY_SN_PREFIX="10.$NETWORK_PREFIX.0.0/24"
export MY_PUBLIC_IP_NAME="myPublicIP$RANDOM_ID"
export MY_DNS_LABEL="mydnslabel$RANDOM_ID"
export MY_NSG_NAME="myNSGName$RANDOM_ID"

#CREATE A RESOURCE GROUP
az group create \
--name $MY_RESOURCE_GROUP_NAME \
--location $REGION -o JSON

#SET UP VM NETWORK
az network vnet create \
--resource-group $MY_RESOURCE_GROUP_NAME \
--name $MY_VNET_NAME \
--location $REGION \
--address-prefix $MY_VNET_PREFIX \
--subnet-name $MY_SN_NAME \
--subnet-prefix $MY_SN_PREFIX -o JSON

#CREATE STATIC PUBLIC IP
az network public-ip create \
--name $MY_PUBLIC_IP_NAME \
--location $REGION \
--resource-group $MY_RESOURCE_GROUP_NAME \
--dns-name $MY_DNS_LABEL \
--sku Standard \
--allocation-method static \
--version IPv4 \
--zone 1 2 3 -o JSON

#CREATE NSG
az network nsg create \
--resource-group $MY_RESOURCE_GROUP_NAME \
--name $MY_NSG_NAME \
--location $REGION -o JSON

#CREATE NSG RULES
az network nsg rule create \
--resource-group $MY_RESOURCE_GROUP_NAME \
--nsg-name $MY_NSG_NAME \
--name $MY_NSG_SSH_RULE \
--access Allow \
--protocol Tcp \
--direction Inbound \
--priority 100 \
--source-address-prefix '*' \
--source-port-range '*' \
--destination-address-prefix '*' \
--destination-port-range 22 80 443 -o JSON

#CREATE NIC
az network nic create \
--resource-group $MY_RESOURCE_GROUP_NAME \
--name $MY_VM_NIC_NAME \
--location $REGION \
--ip-forwarding false \
--subnet $MY_SN_NAME \
--vnet-name $MY_VNET_NAME \
--network-security-group $MY_NSG_NAME \
--public-ip-address $MY_PUBLIC_IP_NAME -o JSON

#CREATE LINUX VM
az vm create \
--resource-group $MY_RESOURCE_GROUP_NAME \
--name $MY_VM_NAME \
--image $MY_VM_IMAGE \
--admin-username $MY_VM_USERNAME \
--generate-ssh-keys \
--assign-identity $MY_VM_ID \
--size $MY_VM_SIZE \
--custom-data cloud-init-nginx.txt \
--nics $MY_VM_NIC_NAME
Loading
Loading