From 9f7d0326bfbecf442af42dd4e2b61b3a051160c7 Mon Sep 17 00:00:00 2001 From: Automated workflow Date: Tue, 26 Nov 2024 16:18:17 +0000 Subject: [PATCH] Committing workflows --- .github/workflows/README_md.yml | 20 ++ ...te-acrpull-service-principal_README_md.yml | 48 ++++ .../acr_create-settings-xml_README_md.yml | 64 +++++ .github/workflows/acr_graalvm_README_md.yml | 62 +++++ .github/workflows/acr_helidon_README_md.yml | 65 +++++ .../workflows/acr_helloworldjob_README_md.yml | 64 +++++ .github/workflows/afd_README_md.yml | 20 ++ ..._add-origins-to-origin-group_README_md.yml | 210 ++++++++++++++++ .github/workflows/afd_add-route_README_md.yml | 221 +++++++++++++++++ .../afd_create-endpoint_README_md.yml | 64 +++++ .../afd_create-origin-group_README_md.yml | 84 +++++++ .../afd_create-profile_README_md.yml | 50 ++++ .github/workflows/aks_README_md.yml | 20 ++ .../aks_create-kube-config_README_md.yml | 58 +++++ .github/workflows/aks_create_README_md.yml | 51 ++++ .github/workflows/aks_graalvm_README_md.yml | 144 +++++++++++ .../workflows/aks_springboot_README_md.yml | 121 +++++++++ .github/workflows/aks_tomcat_README_md.yml | 152 ++++++++++++ .../workflows/aks_use-your-acr_README_md.yml | 71 ++++++ .github/workflows/aks_wildfly_README_md.yml | 142 +++++++++++ .github/workflows/appconfig_README_md.yml | 20 ++ .../appconfig_add-key-value_README_md.yml | 50 ++++ .../workflows/appconfig_create_README_md.yml | 45 ++++ .github/workflows/appservice_README_md.yml | 20 ++ ...pservice_container-glassfish_README_md.yml | 157 ++++++++++++ ...appservice_container-graalvm_README_md.yml | 156 ++++++++++++ .../appservice_container-jetty_README_md.yml | 154 ++++++++++++ .../appservice_container-payara_README_md.yml | 156 ++++++++++++ ...rvice_create-deployment-slot_README_md.yml | 86 +++++++ .../appservice_create-plan_README_md.yml | 52 ++++ .../appservice_delete-plan_README_md.yml | 61 +++++ .../appservice_delete-webapp_README_md.yml | 76 ++++++ ...ce_deploy-to-deployment-slot_README_md.yml | 112 +++++++++ .../appservice_docker-tomcat_README_md.yml | 154 ++++++++++++ .../appservice_docker-wildfly_README_md.yml | 154 ++++++++++++ ...va-springboot-github-actions_README_md.yml | 18 ++ .../appservice_javase-quarkus_README_md.yml | 80 ++++++ ...appservice_javase-springboot_README_md.yml | 81 +++++++ ...service_jboss-eap-helloworld_README_md.yml | 79 ++++++ .../appservice_list-webapp_README_md.yml | 70 ++++++ .../appservice_scale-manually_README_md.yml | 80 ++++++ ...service_swap-deployment-slot_README_md.yml | 120 +++++++++ ...appservice_tomcat-helloworld_README_md.yml | 78 ++++++ .github/workflows/aro_README_md.yml | 20 ++ .github/workflows/aro_create_README_md.yml | 68 ++++++ .../workflows/cognitiveservices_README_md.yml | 20 ++ ...th-semantic-kernel-and-gpt35_README_md.yml | 117 +++++++++ ...eservices_create-gpt35-model_README_md.yml | 75 ++++++ ...rvices_create-openai-account_README_md.yml | 51 ++++ .github/workflows/container_README_md.yml | 20 ++ .../workflows/container_quarkus_README_md.yml | 89 +++++++ .../workflows/container_tomcat_README_md.yml | 85 +++++++ .../workflows/container_wildfly_README_md.yml | 88 +++++++ ...ntainerapp_create-manual-job_README_md.yml | 107 ++++++++ .../containerapp_dropwizard_README_md.yml | 106 ++++++++ ...tainerapp_execute-manual-job_README_md.yml | 143 +++++++++++ ...nerapp_get-job-execution-log_README_md.yml | 229 ++++++++++++++++++ .../containerapp_helidon_README_md.yml | 111 +++++++++ ...ainerapp_list-job-executions_README_md.yml | 183 ++++++++++++++ .github/workflows/cosmosdb_README_md.yml | 20 ++ ...osmosdb_create-sql-container_README_md.yml | 71 ++++++ ...cosmosdb_create-sql-database_README_md.yml | 59 +++++ ..._create-sql-leases-container_README_md.yml | 71 ++++++ .../workflows/cosmosdb_create_README_md.yml | 46 ++++ ...sert-item-into-sql-container_README_md.yml | 135 +++++++++++ ...db_sql-change-feed-processor_README_md.yml | 117 +++++++++ .github/workflows/eventhubs_README_md.yml | 20 ++ .../eventhubs_create-eventhub_README_md.yml | 59 +++++ .../eventhubs_create-namespace_README_md.yml | 43 ++++ .../eventhubs_receive-event_README_md.yml | 164 +++++++++++++ .../eventhubs_send-event_README_md.yml | 98 ++++++++ .github/workflows/functionapp_README_md.yml | 20 ++ .../functionapp_cosmosdb-output_README_md.yml | 80 ++++++ .../functionapp_helloworld_README_md.yml | 72 ++++++ .../functionapp_install-tools_README_md.yml | 32 +++ .github/workflows/group_README_md.yml | 20 ++ .github/workflows/keyvault_README_md.yml | 20 ++ .../keyvault_add-secret_README_md.yml | 56 +++++ ...eate-self-signed-certificate_README_md.yml | 57 +++++ .../workflows/keyvault_create_README_md.yml | 47 ++++ ...spring-boot-mtls-client-side_README_md.yml | 19 ++ ...spring-boot-mtls-server-side_README_md.yml | 19 ++ ..._spring-boot-ssl-server-side_README_md.yml | 19 ++ .github/workflows/kusto_README_md.yml | 20 ++ .../kusto_create-database_README_md.yml | 71 ++++++ .../kusto_create-table_README_md.yml | 61 +++++ .github/workflows/kusto_create_README_md.yml | 55 +++++ .../kusto_ingest-client_README_md.yml | 61 +++++ .github/workflows/monitor_README_md.yml | 20 ++ ...eate-log-analytics-workspace_README_md.yml | 69 ++++++ .github/workflows/mysql_README_md.yml | 20 ++ .github/workflows/mysql_create_README_md.yml | 59 +++++ .../workflows/mysql_get-country_README_md.yml | 93 +++++++ ...our-mysql-database-with-data_README_md.yml | 79 ++++++ ...sql_open-firewall-to-your-ip_README_md.yml | 67 +++++ .github/workflows/network_README_md.yml | 20 ++ .../network_create-vnet_README_md.yml | 41 ++++ .github/workflows/postgres_README_md.yml | 20 ++ .../workflows/postgres_create_README_md.yml | 50 ++++ .../postgres_get-country_README_md.yml | 83 +++++++ ...ostgresql-database-with-data_README_md.yml | 74 ++++++ ...res_open-firewall-to-your-ip_README_md.yml | 58 +++++ .github/workflows/redis_README_md.yml | 20 ++ .github/workflows/redis_create_README_md.yml | 44 ++++ .github/workflows/redis_lettuce_README_md.yml | 55 +++++ .../workflows/redis_springboot_README_md.yml | 18 ++ .github/workflows/servicebus_README_md.yml | 20 ++ .../servicebus_create-queue_README_md.yml | 49 ++++ .../workflows/servicebus_create_README_md.yml | 42 ++++ ...rvicebus_receive-jms-message_README_md.yml | 75 ++++++ .../servicebus_receive-message_README_md.yml | 71 ++++++ .../servicebus_send-jms-message_README_md.yml | 64 +++++ .../servicebus_send-message_README_md.yml | 60 +++++ .github/workflows/spring_README_md.yml | 20 ++ .../spring_config-server_README_md.yml | 49 ++++ .github/workflows/spring_create_README_md.yml | 43 ++++ .../workflows/spring_helloworld_README_md.yml | 75 ++++++ ...g_spring-cloud-config-server_README_md.yml | 18 ++ .github/workflows/sql_README_md.yml | 20 ++ .github/workflows/sql_create_README_md.yml | 47 ++++ .../sql_deploy-springboot-sql_README_md.yml | 18 ++ .../workflows/sql_get-country_README_md.yml | 79 ++++++ ...our-mssql-database-with-data_README_md.yml | 71 ++++++ ...sql_open-firewall-to-your-ip_README_md.yml | 53 ++++ .../workflows/storage_create_README_md.yml | 45 ++++ ...torage_enable-static-website_README_md.yml | 53 ++++ ...load-files-to-static-website_README_md.yml | 71 ++++++ 127 files changed, 8867 insertions(+) create mode 100644 .github/workflows/README_md.yml create mode 100644 .github/workflows/acr_create-acrpull-service-principal_README_md.yml create mode 100644 .github/workflows/acr_create-settings-xml_README_md.yml create mode 100644 .github/workflows/acr_graalvm_README_md.yml create mode 100644 .github/workflows/acr_helidon_README_md.yml create mode 100644 .github/workflows/acr_helloworldjob_README_md.yml create mode 100644 .github/workflows/afd_README_md.yml create mode 100644 .github/workflows/afd_add-origins-to-origin-group_README_md.yml create mode 100644 .github/workflows/afd_add-route_README_md.yml create mode 100644 .github/workflows/afd_create-endpoint_README_md.yml create mode 100644 .github/workflows/afd_create-origin-group_README_md.yml create mode 100644 .github/workflows/afd_create-profile_README_md.yml create mode 100644 .github/workflows/aks_README_md.yml create mode 100644 .github/workflows/aks_create-kube-config_README_md.yml create mode 100644 .github/workflows/aks_create_README_md.yml create mode 100644 .github/workflows/aks_graalvm_README_md.yml create mode 100644 .github/workflows/aks_springboot_README_md.yml create mode 100644 .github/workflows/aks_tomcat_README_md.yml create mode 100644 .github/workflows/aks_use-your-acr_README_md.yml create mode 100644 .github/workflows/aks_wildfly_README_md.yml create mode 100644 .github/workflows/appconfig_README_md.yml create mode 100644 .github/workflows/appconfig_add-key-value_README_md.yml create mode 100644 .github/workflows/appconfig_create_README_md.yml create mode 100644 .github/workflows/appservice_README_md.yml create mode 100644 .github/workflows/appservice_container-glassfish_README_md.yml create mode 100644 .github/workflows/appservice_container-graalvm_README_md.yml create mode 100644 .github/workflows/appservice_container-jetty_README_md.yml create mode 100644 .github/workflows/appservice_container-payara_README_md.yml create mode 100644 .github/workflows/appservice_create-deployment-slot_README_md.yml create mode 100644 .github/workflows/appservice_create-plan_README_md.yml create mode 100644 .github/workflows/appservice_delete-plan_README_md.yml create mode 100644 .github/workflows/appservice_delete-webapp_README_md.yml create mode 100644 .github/workflows/appservice_deploy-to-deployment-slot_README_md.yml create mode 100644 .github/workflows/appservice_docker-tomcat_README_md.yml create mode 100644 .github/workflows/appservice_docker-wildfly_README_md.yml create mode 100644 .github/workflows/appservice_java-springboot-github-actions_README_md.yml create mode 100644 .github/workflows/appservice_javase-quarkus_README_md.yml create mode 100644 .github/workflows/appservice_javase-springboot_README_md.yml create mode 100644 .github/workflows/appservice_jboss-eap-helloworld_README_md.yml create mode 100644 .github/workflows/appservice_list-webapp_README_md.yml create mode 100644 .github/workflows/appservice_scale-manually_README_md.yml create mode 100644 .github/workflows/appservice_swap-deployment-slot_README_md.yml create mode 100644 .github/workflows/appservice_tomcat-helloworld_README_md.yml create mode 100644 .github/workflows/aro_README_md.yml create mode 100644 .github/workflows/aro_create_README_md.yml create mode 100644 .github/workflows/cognitiveservices_README_md.yml create mode 100644 .github/workflows/cognitiveservices_chat-with-semantic-kernel-and-gpt35_README_md.yml create mode 100644 .github/workflows/cognitiveservices_create-gpt35-model_README_md.yml create mode 100644 .github/workflows/cognitiveservices_create-openai-account_README_md.yml create mode 100644 .github/workflows/container_README_md.yml create mode 100644 .github/workflows/container_quarkus_README_md.yml create mode 100644 .github/workflows/container_tomcat_README_md.yml create mode 100644 .github/workflows/container_wildfly_README_md.yml create mode 100644 .github/workflows/containerapp_create-manual-job_README_md.yml create mode 100644 .github/workflows/containerapp_dropwizard_README_md.yml create mode 100644 .github/workflows/containerapp_execute-manual-job_README_md.yml create mode 100644 .github/workflows/containerapp_get-job-execution-log_README_md.yml create mode 100644 .github/workflows/containerapp_helidon_README_md.yml create mode 100644 .github/workflows/containerapp_list-job-executions_README_md.yml create mode 100644 .github/workflows/cosmosdb_README_md.yml create mode 100644 .github/workflows/cosmosdb_create-sql-container_README_md.yml create mode 100644 .github/workflows/cosmosdb_create-sql-database_README_md.yml create mode 100644 .github/workflows/cosmosdb_create-sql-leases-container_README_md.yml create mode 100644 .github/workflows/cosmosdb_create_README_md.yml create mode 100644 .github/workflows/cosmosdb_insert-item-into-sql-container_README_md.yml create mode 100644 .github/workflows/cosmosdb_sql-change-feed-processor_README_md.yml create mode 100644 .github/workflows/eventhubs_README_md.yml create mode 100644 .github/workflows/eventhubs_create-eventhub_README_md.yml create mode 100644 .github/workflows/eventhubs_create-namespace_README_md.yml create mode 100644 .github/workflows/eventhubs_receive-event_README_md.yml create mode 100644 .github/workflows/eventhubs_send-event_README_md.yml create mode 100644 .github/workflows/functionapp_README_md.yml create mode 100644 .github/workflows/functionapp_cosmosdb-output_README_md.yml create mode 100644 .github/workflows/functionapp_helloworld_README_md.yml create mode 100644 .github/workflows/functionapp_install-tools_README_md.yml create mode 100644 .github/workflows/group_README_md.yml create mode 100644 .github/workflows/keyvault_README_md.yml create mode 100644 .github/workflows/keyvault_add-secret_README_md.yml create mode 100644 .github/workflows/keyvault_create-self-signed-certificate_README_md.yml create mode 100644 .github/workflows/keyvault_create_README_md.yml create mode 100644 .github/workflows/keyvault_spring-boot-mtls-client-side_README_md.yml create mode 100644 .github/workflows/keyvault_spring-boot-mtls-server-side_README_md.yml create mode 100644 .github/workflows/keyvault_spring-boot-ssl-server-side_README_md.yml create mode 100644 .github/workflows/kusto_README_md.yml create mode 100644 .github/workflows/kusto_create-database_README_md.yml create mode 100644 .github/workflows/kusto_create-table_README_md.yml create mode 100644 .github/workflows/kusto_create_README_md.yml create mode 100644 .github/workflows/kusto_ingest-client_README_md.yml create mode 100644 .github/workflows/monitor_README_md.yml create mode 100644 .github/workflows/monitor_create-log-analytics-workspace_README_md.yml create mode 100644 .github/workflows/mysql_README_md.yml create mode 100644 .github/workflows/mysql_create_README_md.yml create mode 100644 .github/workflows/mysql_get-country_README_md.yml create mode 100644 .github/workflows/mysql_load-your-mysql-database-with-data_README_md.yml create mode 100644 .github/workflows/mysql_open-firewall-to-your-ip_README_md.yml create mode 100644 .github/workflows/network_README_md.yml create mode 100644 .github/workflows/network_create-vnet_README_md.yml create mode 100644 .github/workflows/postgres_README_md.yml create mode 100644 .github/workflows/postgres_create_README_md.yml create mode 100644 .github/workflows/postgres_get-country_README_md.yml create mode 100644 .github/workflows/postgres_load-your-postgresql-database-with-data_README_md.yml create mode 100644 .github/workflows/postgres_open-firewall-to-your-ip_README_md.yml create mode 100644 .github/workflows/redis_README_md.yml create mode 100644 .github/workflows/redis_create_README_md.yml create mode 100644 .github/workflows/redis_lettuce_README_md.yml create mode 100644 .github/workflows/redis_springboot_README_md.yml create mode 100644 .github/workflows/servicebus_README_md.yml create mode 100644 .github/workflows/servicebus_create-queue_README_md.yml create mode 100644 .github/workflows/servicebus_create_README_md.yml create mode 100644 .github/workflows/servicebus_receive-jms-message_README_md.yml create mode 100644 .github/workflows/servicebus_receive-message_README_md.yml create mode 100644 .github/workflows/servicebus_send-jms-message_README_md.yml create mode 100644 .github/workflows/servicebus_send-message_README_md.yml create mode 100644 .github/workflows/spring_README_md.yml create mode 100644 .github/workflows/spring_config-server_README_md.yml create mode 100644 .github/workflows/spring_create_README_md.yml create mode 100644 .github/workflows/spring_helloworld_README_md.yml create mode 100644 .github/workflows/spring_spring-cloud-config-server_README_md.yml create mode 100644 .github/workflows/sql_README_md.yml create mode 100644 .github/workflows/sql_create_README_md.yml create mode 100644 .github/workflows/sql_deploy-springboot-sql_README_md.yml create mode 100644 .github/workflows/sql_get-country_README_md.yml create mode 100644 .github/workflows/sql_load-your-mssql-database-with-data_README_md.yml create mode 100644 .github/workflows/sql_open-firewall-to-your-ip_README_md.yml create mode 100644 .github/workflows/storage_create_README_md.yml create mode 100644 .github/workflows/storage_enable-static-website_README_md.yml create mode 100644 .github/workflows/storage_upload-files-to-static-website_README_md.yml diff --git a/.github/workflows/README_md.yml b/.github/workflows/README_md.yml new file mode 100644 index 00000000..f6a8a86f --- /dev/null +++ b/.github/workflows/README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/acr_create-acrpull-service-principal_README_md.yml b/.github/workflows/acr_create-acrpull-service-principal_README_md.yml new file mode 100644 index 00000000..229d5ec4 --- /dev/null +++ b/.github/workflows/acr_create-acrpull-service-principal_README_md.yml @@ -0,0 +1,48 @@ +on: + schedule: + - cron: '0 18 * * 5' + workflow_dispatch: + +name: 'acr/create-acrpull-service-principal/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/acr_create-settings-xml_README_md.yml b/.github/workflows/acr_create-settings-xml_README_md.yml new file mode 100644 index 00000000..a1f983b4 --- /dev/null +++ b/.github/workflows/acr_create-settings-xml_README_md.yml @@ -0,0 +1,64 @@ +on: + schedule: + - cron: '0 17 * * 5' + workflow_dispatch: + +name: 'acr/create-settings-xml/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/create-settings-xml + + export ACR_USERNAME=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query username --output tsv` + export ACR_PASSWORD=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query 'passwords[0].value' --output tsv` + export SETTINGS_XML=$PWD/settings.xml + + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true + if [[ -z $ACR_USERNAME ]]; then + echo "ACR Admin username was not found" + exit 1 + fi + if [[ -z $ACR_PASSWORD ]]; then + echo "ACR Admin passsword was not found" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/acr_graalvm_README_md.yml b/.github/workflows/acr_graalvm_README_md.yml new file mode 100644 index 00000000..94a6fa95 --- /dev/null +++ b/.github/workflows/acr_graalvm_README_md.yml @@ -0,0 +1,62 @@ +on: + schedule: + - cron: '0 14 * * 5' + workflow_dispatch: + +name: 'acr/graalvm/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/graalvm + + mvn package + docker build -t builder -f Dockerfile.builder . + docker run --rm --tty -v $PWD/../..:/mnt builder mvn -P graalvm -pl acr/graalvm clean install + export ACR_GRAALVM_IMAGE=graalvm:latest + + az acr build --registry $ACR_NAME --image $ACR_GRAALVM_IMAGE . + + cd ../.. + + + export RESULT=$(az acr repository show --name $ACR_NAME --image $ACR_GRAALVM_IMAGE) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ -z $RESULT ]]; then + echo "Unable to find $ACR_GRAALVM_IMAGE image" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/acr_helidon_README_md.yml b/.github/workflows/acr_helidon_README_md.yml new file mode 100644 index 00000000..8d7e06d9 --- /dev/null +++ b/.github/workflows/acr_helidon_README_md.yml @@ -0,0 +1,65 @@ +on: + schedule: + - cron: '0 13 * * 5' + workflow_dispatch: + +name: 'acr/helidon/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helidon + + mvn package + export ACR_HELIDON_IMAGE=helidon:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELIDON_IMAGE . + + cd ../.. + + + export RESULT=$(az acr repository show --name $ACR_NAME --image $ACR_HELIDON_IMAGE) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ -z $RESULT ]]; then + echo "Unable to find $ACR_HELIDON_IMAGE image" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/acr_helloworldjob_README_md.yml b/.github/workflows/acr_helloworldjob_README_md.yml new file mode 100644 index 00000000..ec8e9250 --- /dev/null +++ b/.github/workflows/acr_helloworldjob_README_md.yml @@ -0,0 +1,64 @@ +on: + schedule: + - cron: '0 12 * * 5' + workflow_dispatch: + +name: 'acr/helloworldjob/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + + export RESULT=$(az acr repository show --name $ACR_NAME --image $ACR_HELLOWORLDJOB_IMAGE) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ -z $RESULT ]]; then + echo "Unable to find " $ACR_HELLOWORLDJOB_IMAGE " image" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/afd_README_md.yml b/.github/workflows/afd_README_md.yml new file mode 100644 index 00000000..c2dc255b --- /dev/null +++ b/.github/workflows/afd_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'afd/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/afd_add-origins-to-origin-group_README_md.yml b/.github/workflows/afd_add-origins-to-origin-group_README_md.yml new file mode 100644 index 00000000..e7fbc1ac --- /dev/null +++ b/.github/workflows/afd_add-origins-to-origin-group_README_md.yml @@ -0,0 +1,210 @@ +on: + schedule: + - cron: '0 3 * * 5' + workflow_dispatch: + +name: 'afd/add-origins-to-origin-group/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AFD_PROFILE_NAME ]]; then + export AFD_PROFILE_NAME=javazafd$RANDOM + fi + az afd profile create \ + --profile-name $AFD_PROFILE_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Premium_AzureFrontDoor + + if [[ -z $AFD_ENDPOINT_NAME ]]; then + export AFD_ENDPOINT_NAME=javazafdendp$RANDOM + fi + az afd endpoint create \ + --resource-group $RESOURCE_GROUP \ + --endpoint-name $AFD_ENDPOINT_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --enabled-state Enabled + + if [[ -z $AFD_ORIGIN_GROUP_NAME ]]; then + export AFD_ORIGIN_GROUP_NAME=javazafdogrp$RANDOM + fi + az afd origin-group create \ + --resource-group $RESOURCE_GROUP \ + --origin-group-name $AFD_ORIGIN_GROUP_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --probe-request-type GET \ + --probe-protocol Http \ + --probe-interval-in-seconds 60 \ + --probe-path / \ + --sample-size 4 \ + --successful-samples-required 3 \ + --additional-latency-in-milliseconds 50 + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/javase-springboot + + mvn package + export APPSERVICE_JAVASE_SPRINGBOOT=javazappsvc-javase-springboot-$RANDOM + + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_JAVASE_SPRINGBOOT \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 240 + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/javase-quarkus + + mvn package + export APPSERVICE_JAVASE_QUARKUS=javazappsvc-javase-quarkus-$RANDOM + + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_JAVASE_QUARKUS \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + cd ../.. + + export AFD_PRIMARY_HOST_NAME=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JAVASE_SPRINGBOOT --output tsv --query defaultHostName) + az afd origin create \ + --resource-group $RESOURCE_GROUP \ + --host-name $AFD_PRIMARY_HOST_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --origin-group-name $AFD_ORIGIN_GROUP_NAME \ + --origin-name springboot \ + --origin-host-header $AFD_PRIMARY_HOST_NAME \ + --priority 1 \ + --weight 1000 \ + --enabled-state Enabled \ + --http-port 80 \ + --https-port 443 + export AFD_SECONDARY_HOST_NAME=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JAVASE_QUARKUS --output tsv --query defaultHostName) + az afd origin create \ + --resource-group $RESOURCE_GROUP \ + --host-name $AFD_SECONDARY_HOST_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --origin-group-name $AFD_ORIGIN_GROUP_NAME \ + --origin-host-header $AFD_SECONDARY_HOST_NAME \ + --origin-name quarkus \ + --priority 1 \ + --weight 1000 \ + --enabled-state Enabled \ + --http-port 80 \ + --https-port 443 + + export RESULT=$(az afd origin show --origin-name springboot --origin-group-name $AFD_ORIGIN_GROUP_NAME --profile-name $AFD_PROFILE_NAME --resource-group $RESOURCE_GROUP --output tsv --query provisioningState) + if [[ "$RESULT" != Succeeded ]]; then + az group delete --name $RESOURCE_GROUP --yes || true + echo "Azure Front Door Origin - springboot - was not provisioned properly" + exit 1 + fi + export RESULT=$(az afd origin show --origin-name quarkus --origin-group-name $AFD_ORIGIN_GROUP_NAME --profile-name $AFD_PROFILE_NAME --resource-group $RESOURCE_GROUP --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Azure Front Door Origin Group - quarkus - was not provisioned properly" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/afd_add-route_README_md.yml b/.github/workflows/afd_add-route_README_md.yml new file mode 100644 index 00000000..f377bf13 --- /dev/null +++ b/.github/workflows/afd_add-route_README_md.yml @@ -0,0 +1,221 @@ +on: + schedule: + - cron: '0 2 * * 5' + workflow_dispatch: + +name: 'afd/add-route/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AFD_PROFILE_NAME ]]; then + export AFD_PROFILE_NAME=javazafd$RANDOM + fi + az afd profile create \ + --profile-name $AFD_PROFILE_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Premium_AzureFrontDoor + + if [[ -z $AFD_ENDPOINT_NAME ]]; then + export AFD_ENDPOINT_NAME=javazafdendp$RANDOM + fi + az afd endpoint create \ + --resource-group $RESOURCE_GROUP \ + --endpoint-name $AFD_ENDPOINT_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --enabled-state Enabled + + if [[ -z $AFD_ORIGIN_GROUP_NAME ]]; then + export AFD_ORIGIN_GROUP_NAME=javazafdogrp$RANDOM + fi + az afd origin-group create \ + --resource-group $RESOURCE_GROUP \ + --origin-group-name $AFD_ORIGIN_GROUP_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --probe-request-type GET \ + --probe-protocol Http \ + --probe-interval-in-seconds 60 \ + --probe-path / \ + --sample-size 4 \ + --successful-samples-required 3 \ + --additional-latency-in-milliseconds 50 + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/javase-springboot + + mvn package + export APPSERVICE_JAVASE_SPRINGBOOT=javazappsvc-javase-springboot-$RANDOM + + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_JAVASE_SPRINGBOOT \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 240 + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/javase-quarkus + + mvn package + export APPSERVICE_JAVASE_QUARKUS=javazappsvc-javase-quarkus-$RANDOM + + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_JAVASE_QUARKUS \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + cd ../.. + + export AFD_PRIMARY_HOST_NAME=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JAVASE_SPRINGBOOT --output tsv --query defaultHostName) + az afd origin create \ + --resource-group $RESOURCE_GROUP \ + --host-name $AFD_PRIMARY_HOST_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --origin-group-name $AFD_ORIGIN_GROUP_NAME \ + --origin-name springboot \ + --origin-host-header $AFD_PRIMARY_HOST_NAME \ + --priority 1 \ + --weight 1000 \ + --enabled-state Enabled \ + --http-port 80 \ + --https-port 443 + export AFD_SECONDARY_HOST_NAME=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JAVASE_QUARKUS --output tsv --query defaultHostName) + az afd origin create \ + --resource-group $RESOURCE_GROUP \ + --host-name $AFD_SECONDARY_HOST_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --origin-group-name $AFD_ORIGIN_GROUP_NAME \ + --origin-host-header $AFD_SECONDARY_HOST_NAME \ + --origin-name quarkus \ + --priority 1 \ + --weight 1000 \ + --enabled-state Enabled \ + --http-port 80 \ + --https-port 443 + az afd route create \ + --resource-group $RESOURCE_GROUP \ + --profile-name $AFD_PROFILE_NAME \ + --endpoint-name $AFD_ENDPOINT_NAME \ + --forwarding-protocol MatchRequest \ + --route-name route \ + --https-redirect Enabled \ + --origin-group $AFD_ORIGIN_GROUP_NAME \ + --supported-protocols Http Https \ + --link-to-default-domain Enabled + + sleep 300 + export URL=https://$(az afd endpoint show --resource-group $RESOURCE_GROUP --profile-name $AFD_PROFILE_NAME --endpoint-name $AFD_ENDPOINT_NAME --query hostName --output tsv) + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello"* ]]; then + echo "Response did not contain 'Hello'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/afd_create-endpoint_README_md.yml b/.github/workflows/afd_create-endpoint_README_md.yml new file mode 100644 index 00000000..717ab52a --- /dev/null +++ b/.github/workflows/afd_create-endpoint_README_md.yml @@ -0,0 +1,64 @@ +on: + schedule: + - cron: '0 1 * * 5' + workflow_dispatch: + +name: 'afd/create-endpoint/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AFD_PROFILE_NAME ]]; then + export AFD_PROFILE_NAME=javazafd$RANDOM + fi + az afd profile create \ + --profile-name $AFD_PROFILE_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Premium_AzureFrontDoor + + if [[ -z $AFD_ENDPOINT_NAME ]]; then + export AFD_ENDPOINT_NAME=javazafdendp$RANDOM + fi + az afd endpoint create \ + --resource-group $RESOURCE_GROUP \ + --endpoint-name $AFD_ENDPOINT_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --enabled-state Enabled + + export RESULT=$(az afd endpoint show --endpoint-name $AFD_ENDPOINT_NAME --profile-name $AFD_PROFILE_NAME --resource-group $RESOURCE_GROUP --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Azure Front Door Endpoint $AFD_ENDPOINT_NAME was not provisioned properly" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/afd_create-origin-group_README_md.yml b/.github/workflows/afd_create-origin-group_README_md.yml new file mode 100644 index 00000000..b3d73241 --- /dev/null +++ b/.github/workflows/afd_create-origin-group_README_md.yml @@ -0,0 +1,84 @@ +on: + schedule: + - cron: '0 0 * * 5' + workflow_dispatch: + +name: 'afd/create-origin-group/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AFD_PROFILE_NAME ]]; then + export AFD_PROFILE_NAME=javazafd$RANDOM + fi + az afd profile create \ + --profile-name $AFD_PROFILE_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Premium_AzureFrontDoor + + if [[ -z $AFD_ENDPOINT_NAME ]]; then + export AFD_ENDPOINT_NAME=javazafdendp$RANDOM + fi + az afd endpoint create \ + --resource-group $RESOURCE_GROUP \ + --endpoint-name $AFD_ENDPOINT_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --enabled-state Enabled + + if [[ -z $AFD_ORIGIN_GROUP_NAME ]]; then + export AFD_ORIGIN_GROUP_NAME=javazafdogrp$RANDOM + fi + az afd origin-group create \ + --resource-group $RESOURCE_GROUP \ + --origin-group-name $AFD_ORIGIN_GROUP_NAME \ + --profile-name $AFD_PROFILE_NAME \ + --probe-request-type GET \ + --probe-protocol Http \ + --probe-interval-in-seconds 60 \ + --probe-path / \ + --sample-size 4 \ + --successful-samples-required 3 \ + --additional-latency-in-milliseconds 50 + + export RESULT=$(az afd origin-group show --origin-group-name $AFD_ORIGIN_GROUP_NAME --profile-name $AFD_PROFILE_NAME --resource-group $RESOURCE_GROUP --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Azure Front Door Origin Group $AFD_ORIGIN_GROUP_NAME was not provisioned properly" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/afd_create-profile_README_md.yml b/.github/workflows/afd_create-profile_README_md.yml new file mode 100644 index 00000000..d9d429bf --- /dev/null +++ b/.github/workflows/afd_create-profile_README_md.yml @@ -0,0 +1,50 @@ +on: + schedule: + - cron: '0 23 * * 4' + workflow_dispatch: + +name: 'afd/create-profile/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AFD_PROFILE_NAME ]]; then + export AFD_PROFILE_NAME=javazafd$RANDOM + fi + az afd profile create \ + --profile-name $AFD_PROFILE_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Premium_AzureFrontDoor + + export RESULT=$(az afd profile show --profile-name $AFD_PROFILE_NAME --resource-group $RESOURCE_GROUP --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Azure Front Door Profile $AFD_PROFILE_NAME was not provisioned properly" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/aks_README_md.yml b/.github/workflows/aks_README_md.yml new file mode 100644 index 00000000..e7a13207 --- /dev/null +++ b/.github/workflows/aks_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'aks/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/aks_create-kube-config_README_md.yml b/.github/workflows/aks_create-kube-config_README_md.yml new file mode 100644 index 00000000..e3307d77 --- /dev/null +++ b/.github/workflows/aks_create-kube-config_README_md.yml @@ -0,0 +1,58 @@ +on: + schedule: + - cron: '0 21 * * 4' + workflow_dispatch: + +name: 'aks/create-kube-config/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + + cd aks/create-kube-config + + az aks get-credentials --resource-group $RESOURCE_GROUP --name $AKS --admin --file config + export KUBECONFIG=$PWD/config + + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true + if [[ ! -f $KUBECONFIG ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/aks_create_README_md.yml b/.github/workflows/aks_create_README_md.yml new file mode 100644 index 00000000..5e595b5d --- /dev/null +++ b/.github/workflows/aks_create_README_md.yml @@ -0,0 +1,51 @@ +on: + schedule: + - cron: '0 22 * * 4' + workflow_dispatch: + +name: 'aks/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + + export RESULT=$(az aks show --name $AKS --resource-group $RESOURCE_GROUP --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/aks_graalvm_README_md.yml b/.github/workflows/aks_graalvm_README_md.yml new file mode 100644 index 00000000..e67e1133 --- /dev/null +++ b/.github/workflows/aks_graalvm_README_md.yml @@ -0,0 +1,144 @@ +on: + schedule: + - cron: '0 20 * * 4' + workflow_dispatch: + +name: 'aks/graalvm/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + + cd aks/create-kube-config + + az aks get-credentials --resource-group $RESOURCE_GROUP --name $AKS --admin --file config + export KUBECONFIG=$PWD/config + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/graalvm + + mvn package + docker build -t builder -f Dockerfile.builder . + docker run --rm --tty -v $PWD/../..:/mnt builder mvn -P graalvm -pl acr/graalvm clean install + export ACR_GRAALVM_IMAGE=graalvm:latest + + az acr build --registry $ACR_NAME --image $ACR_GRAALVM_IMAGE . + + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + az aks update --name $AKS --resource-group $RESOURCE_GROUP --attach-acr $ACR_NAME + + cd aks/graalvm + + sed -i "s/ACR/$ACR_NAME/g" deployment.yml + kubectl apply -f deployment.yml + + cd ../.. +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/aks_springboot_README_md.yml b/.github/workflows/aks_springboot_README_md.yml new file mode 100644 index 00000000..18a07160 --- /dev/null +++ b/.github/workflows/aks_springboot_README_md.yml @@ -0,0 +1,121 @@ +on: + schedule: + - cron: '0 19 * * 4' + workflow_dispatch: + +name: 'aks/springboot/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + + cd aks/create-kube-config + + az aks get-credentials --resource-group $RESOURCE_GROUP --name $AKS --admin --file config + export KUBECONFIG=$PWD/config + + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + az aks update --name $AKS --resource-group $RESOURCE_GROUP --attach-acr $ACR_NAME + + cd aks/springboot + + mvn package + az acr build --registry $ACR_NAME --image springboot:latest . + sed -i "s/ACR/$ACR_NAME/g" deployment.yml + kubectl apply -f deployment.yml + + sleep 240 + export URL=http://$(kubectl get service/springboot --output jsonpath="{.status.loadBalancer.ingress[0].ip}") + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello World"* ]]; then + echo "Response did not contain 'Hello World'" + exit 1 + fi + + + cd ../.. +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/aks_tomcat_README_md.yml b/.github/workflows/aks_tomcat_README_md.yml new file mode 100644 index 00000000..9693495b --- /dev/null +++ b/.github/workflows/aks_tomcat_README_md.yml @@ -0,0 +1,152 @@ +on: + schedule: + - cron: '0 18 * * 4' + workflow_dispatch: + +name: 'aks/tomcat/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + + cd aks/create-kube-config + + az aks get-credentials --resource-group $RESOURCE_GROUP --name $AKS --admin --file config + export KUBECONFIG=$PWD/config + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/tomcat + + mvn package + export ACR_TOMCAT_IMAGE=tomcat:latest + + az acr build --registry $ACR_NAME --image $ACR_TOMCAT_IMAGE . + + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + az aks update --name $AKS --resource-group $RESOURCE_GROUP --attach-acr $ACR_NAME + + cd aks/tomcat + + sed -i "s/ACR/$ACR_NAME/g" deployment.yml + kubectl apply -f deployment.yml + + sleep 240 + export URL=http://$(kubectl get service/tomcat --output jsonpath="{.status.loadBalancer.ingress[0].ip}") + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"custom Tomcat"* ]]; then + echo "Response did not contain 'custom Tomcat'" + exit 1 + fi + + + cd ../.. +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/aks_use-your-acr_README_md.yml b/.github/workflows/aks_use-your-acr_README_md.yml new file mode 100644 index 00000000..2f20e680 --- /dev/null +++ b/.github/workflows/aks_use-your-acr_README_md.yml @@ -0,0 +1,71 @@ +on: + schedule: + - cron: '0 17 * * 4' + workflow_dispatch: + +name: 'aks/use-your-acr/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + az aks update --name $AKS --resource-group $RESOURCE_GROUP --attach-acr $ACR_NAME + + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/aks_wildfly_README_md.yml b/.github/workflows/aks_wildfly_README_md.yml new file mode 100644 index 00000000..a8353023 --- /dev/null +++ b/.github/workflows/aks_wildfly_README_md.yml @@ -0,0 +1,142 @@ +on: + schedule: + - cron: '0 16 * * 4' + workflow_dispatch: + +name: 'aks/wildfly/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + + cd aks/create-kube-config + + az aks get-credentials --resource-group $RESOURCE_GROUP --name $AKS --admin --file config + export KUBECONFIG=$PWD/config + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/wildfly + + mvn package + export ACR_WILDFLY_IMAGE=wildfly:latest + + az acr build --registry $ACR_NAME --image $ACR_WILDFLY_IMAGE . + + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $AKS ]]; then + export AKS=aks-$RANDOM + echo --------------------------------------------------------------------- + echo Creating AKS cluster - $AKS + echo --------------------------------------------------------------------- + az aks create --name $AKS --resource-group $RESOURCE_GROUP --generate-ssh-keys --verbose + sleep 120 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + az aks update --name $AKS --resource-group $RESOURCE_GROUP --attach-acr $ACR_NAME + + cd aks/wildfly + + sed -i "s/ACR/$ACR_NAME/g" deployment.yml + kubectl apply -f deployment.yml + + cd ../.. +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appconfig_README_md.yml b/.github/workflows/appconfig_README_md.yml new file mode 100644 index 00000000..49ea1361 --- /dev/null +++ b/.github/workflows/appconfig_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'appconfig/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appconfig_add-key-value_README_md.yml b/.github/workflows/appconfig_add-key-value_README_md.yml new file mode 100644 index 00000000..075554ab --- /dev/null +++ b/.github/workflows/appconfig_add-key-value_README_md.yml @@ -0,0 +1,50 @@ +on: + schedule: + - cron: '0 15 * * 4' + workflow_dispatch: + +name: 'appconfig/add-key-value/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export APP_CONFIG_NAME=appconfig-$RANDOM + + az appconfig create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APP_CONFIG_NAME \ + --sku Free \ + --enable-public-network true + az appconfig kv set \ + --name $APP_CONFIG_NAME \ + --key myKey \ + --value "My value" \ + --yes + + export RESULT=$(az appconfig kv show --name $APP_CONFIG_NAME --key myKey --query value --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != "My value" ]]; then + echo 'Key/Value was not properly set' + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appconfig_create_README_md.yml b/.github/workflows/appconfig_create_README_md.yml new file mode 100644 index 00000000..df1921c8 --- /dev/null +++ b/.github/workflows/appconfig_create_README_md.yml @@ -0,0 +1,45 @@ +on: + schedule: + - cron: '0 14 * * 4' + workflow_dispatch: + +name: 'appconfig/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export APP_CONFIG_NAME=appconfig-$RANDOM + + az appconfig create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APP_CONFIG_NAME \ + --sku Free \ + --enable-public-network true + + export RESULT=$(az appconfig show --resource-group $RESOURCE_GROUP --name $APP_CONFIG_NAME --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo 'App Configuration was not provisioned' + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_README_md.yml b/.github/workflows/appservice_README_md.yml new file mode 100644 index 00000000..0f91f8f8 --- /dev/null +++ b/.github/workflows/appservice_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'appservice/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_container-glassfish_README_md.yml b/.github/workflows/appservice_container-glassfish_README_md.yml new file mode 100644 index 00000000..ffc25beb --- /dev/null +++ b/.github/workflows/appservice_container-glassfish_README_md.yml @@ -0,0 +1,157 @@ +on: + schedule: + - cron: '0 13 * * 4' + workflow_dispatch: + +name: 'appservice/container-glassfish/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/glassfish + + mvn package + export ACR_GLASSFISH_IMAGE=glassfish:latest + + az acr build --resource-group $RESOURCE_GROUP --registry $ACR_NAME --image $ACR_GLASSFISH_IMAGE . + az acr repository list --name $ACR_NAME --output table + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/create-settings-xml + + export ACR_USERNAME=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query username --output tsv` + export ACR_PASSWORD=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query 'passwords[0].value' --output tsv` + export SETTINGS_XML=$PWD/settings.xml + + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/container-glassfish + + export APPSERVICE_CONTAINER_GLASSFISH=appservice-container-glassfish-$RANDOM + + mvn azure-webapp:deploy \ + --settings=$SETTINGS_XML \ + -DappName=$APPSERVICE_CONTAINER_GLASSFISH \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DimageName=$ACR_GLASSFISH_IMAGE \ + -DresourceGroup=$RESOURCE_GROUP \ + -DserverId=$ACR_NAME + + az webapp show \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_CONTAINER_GLASSFISH \ + --query 'hostNames[0]' \ + --output tsv + + sleep 180 + cd ../.. + + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_CONTAINER_GLASSFISH --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_CONTAINER_GLASSFISH --output tsv --query defaultHostName) + export RESULT=$(curl $URL) + sleep 180 + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"custom Glassfish"* ]]; then + echo "Response did not contain 'custom Glassfish'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_container-graalvm_README_md.yml b/.github/workflows/appservice_container-graalvm_README_md.yml new file mode 100644 index 00000000..4573b857 --- /dev/null +++ b/.github/workflows/appservice_container-graalvm_README_md.yml @@ -0,0 +1,156 @@ +on: + schedule: + - cron: '0 12 * * 4' + workflow_dispatch: + +name: 'appservice/container-graalvm/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/graalvm + + mvn package + docker build -t builder -f Dockerfile.builder . + docker run --rm --tty -v $PWD/../..:/mnt builder mvn -P graalvm -pl acr/graalvm clean install + export ACR_GRAALVM_IMAGE=graalvm:latest + + az acr build --registry $ACR_NAME --image $ACR_GRAALVM_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/create-settings-xml + + export ACR_USERNAME=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query username --output tsv` + export ACR_PASSWORD=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query 'passwords[0].value' --output tsv` + export SETTINGS_XML=$PWD/settings.xml + + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/container-graalvm + + export APPSERVICE_CONTAINER_GRAALVM=appservice-container-graalvm-$RANDOM + + mvn azure-webapp:deploy \ + --settings=$SETTINGS_XML \ + -DappName=$APPSERVICE_CONTAINER_GRAALVM \ + -DimageName=$ACR_GRAALVM_IMAGE \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP \ + -DserverId=$ACR_NAME + + echo `az webapp show \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_CONTAINER_GRAALVM \ + --query 'hostNames[0]' \ + --output tsv`/hello + + sleep 180 + cd ../.. + + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_CONTAINER_GRAALVM --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_CONTAINER_GRAALVM --output tsv --query defaultHostName)/hello + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello"* ]]; then + echo "Response did not contain 'Hello'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_container-jetty_README_md.yml b/.github/workflows/appservice_container-jetty_README_md.yml new file mode 100644 index 00000000..14f3413a --- /dev/null +++ b/.github/workflows/appservice_container-jetty_README_md.yml @@ -0,0 +1,154 @@ +on: + schedule: + - cron: '0 11 * * 4' + workflow_dispatch: + +name: 'appservice/container-jetty/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/jetty + + mvn package + export ACR_JETTY_IMAGE=jetty:latest + + az acr build --resource-group $RESOURCE_GROUP --registry $ACR_NAME --image $ACR_JETTY_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/create-settings-xml + + export ACR_USERNAME=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query username --output tsv` + export ACR_PASSWORD=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query 'passwords[0].value' --output tsv` + export SETTINGS_XML=$PWD/settings.xml + + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/container-jetty + + export APPSERVICE_CONTAINER_JETTY=appservice-container-jetty-$RANDOM + + mvn azure-webapp:deploy \ + --settings=$SETTINGS_XML \ + -DappName=$APPSERVICE_CONTAINER_JETTY \ + -DimageName=$ACR_JETTY_IMAGE \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP \ + -DserverId=$ACR_NAME + + az webapp show \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_CONTAINER_JETTY \ + --query 'hostNames[0]' \ + --output tsv + + sleep 180 + cd ../.. + + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_CONTAINER_JETTY --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_CONTAINER_JETTY --output tsv --query defaultHostName) + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"custom Jetty"* ]]; then + echo "Response did not contain 'custom Jetty'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_container-payara_README_md.yml b/.github/workflows/appservice_container-payara_README_md.yml new file mode 100644 index 00000000..2b50692a --- /dev/null +++ b/.github/workflows/appservice_container-payara_README_md.yml @@ -0,0 +1,156 @@ +on: + schedule: + - cron: '0 10 * * 4' + workflow_dispatch: + +name: 'appservice/container-payara/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/payara + + mvn package + export ACR_PAYARA_IMAGE=payara:latest + + az acr build --registry $ACR_NAME --image $ACR_PAYARA_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/create-settings-xml + + export ACR_USERNAME=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query username --output tsv` + export ACR_PASSWORD=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query 'passwords[0].value' --output tsv` + export SETTINGS_XML=$PWD/settings.xml + + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/container-payara + + export APPSERVICE_CONTAINER_PAYARA=appservice-container-payara-$RANDOM + + mvn azure-webapp:deploy \ + --settings=$SETTINGS_XML \ + -DappName=$APPSERVICE_CONTAINER_PAYARA \ + -DimageName=$ACR_PAYARA_IMAGE \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP \ + -DserverId=$ACR_NAME + + az webapp show \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_CONTAINER_PAYARA \ + --query hostNames[0] \ + --output tsv + + sleep 180 + cd ../.. + + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_CONTAINER_PAYARA --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_CONTAINER_PAYARA --output tsv --query defaultHostName) + export RESULT=$(curl $URL) + sleep 180 + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"custom Payara"* ]]; then + echo "Response did not contain 'custom Payara'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_create-deployment-slot_README_md.yml b/.github/workflows/appservice_create-deployment-slot_README_md.yml new file mode 100644 index 00000000..e3a8282c --- /dev/null +++ b/.github/workflows/appservice_create-deployment-slot_README_md.yml @@ -0,0 +1,86 @@ +on: + schedule: + - cron: '0 9 * * 4' + workflow_dispatch: + +name: 'appservice/create-deployment-slot/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/tomcat-helloworld + + mvn clean install + export APPSERVICE_TOMCAT_HELLOWORLD=appservice-tomcat-helloworld-$RANDOM + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_TOMCAT_HELLOWORLD \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 60 + cd ../.. + + az webapp deployment slot create \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_TOMCAT_HELLOWORLD \ + --slot staging + az webapp show --name $APPSERVICE_TOMCAT_HELLOWORLD \ + --resource-group $RESOURCE_GROUP \ + --query=defaultHostName + az webapp deployment slot list --name $APPSERVICE_TOMCAT_HELLOWORLD \ + --resource-group $RESOURCE_GROUP \ + --query='[0].defaultHostName' + + export RESULT=$(az webapp deployment slot list --resource-group $RESOURCE_GROUP --name $APPSERVICE_TOMCAT_HELLOWORLD --output tsv --query '[0].state') + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Running ]]; then + echo 'Deployment slot is NOT running' + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_create-plan_README_md.yml b/.github/workflows/appservice_create-plan_README_md.yml new file mode 100644 index 00000000..55937735 --- /dev/null +++ b/.github/workflows/appservice_create-plan_README_md.yml @@ -0,0 +1,52 @@ +on: + schedule: + - cron: '0 0 * * 3' + workflow_dispatch: + +name: 'appservice/create-plan/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + export RESULT=$(az appservice plan show --resource-group $RESOURCE_GROUP --name $APPSERVICE_PLAN --query properties.provisioningState --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_delete-plan_README_md.yml b/.github/workflows/appservice_delete-plan_README_md.yml new file mode 100644 index 00000000..45c15fff --- /dev/null +++ b/.github/workflows/appservice_delete-plan_README_md.yml @@ -0,0 +1,61 @@ +on: + schedule: + - cron: '0 7 * * 4' + workflow_dispatch: + +name: 'appservice/delete-plan/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + az appservice plan delete \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_PLAN \ + --yes + + export RESULT=$(az appservice plan show --resource-group $RESOURCE_GROUP --name $APPSERVICE_PLAN --query provisioningState --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" == Succeeded ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_delete-webapp_README_md.yml b/.github/workflows/appservice_delete-webapp_README_md.yml new file mode 100644 index 00000000..6152a4f1 --- /dev/null +++ b/.github/workflows/appservice_delete-webapp_README_md.yml @@ -0,0 +1,76 @@ +on: + schedule: + - cron: '0 6 * * 4' + workflow_dispatch: + +name: 'appservice/delete-webapp/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/tomcat-helloworld + + mvn clean install + export APPSERVICE_TOMCAT_HELLOWORLD=appservice-tomcat-helloworld-$RANDOM + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_TOMCAT_HELLOWORLD \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 60 + cd ../.. + + az webapp delete --resource-group $RESOURCE_GROUP --name $APPSERVICE_TOMCAT_HELLOWORLD + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_TOMCAT_HELLOWORLD --output tsv --query state) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" == Running ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_deploy-to-deployment-slot_README_md.yml b/.github/workflows/appservice_deploy-to-deployment-slot_README_md.yml new file mode 100644 index 00000000..1af40f9d --- /dev/null +++ b/.github/workflows/appservice_deploy-to-deployment-slot_README_md.yml @@ -0,0 +1,112 @@ +on: + schedule: + - cron: '0 5 * * 4' + workflow_dispatch: + +name: 'appservice/deploy-to-deployment-slot/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/tomcat-helloworld + + mvn clean install + export APPSERVICE_TOMCAT_HELLOWORLD=appservice-tomcat-helloworld-$RANDOM + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_TOMCAT_HELLOWORLD \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 60 + cd ../.. + + az webapp deployment slot create \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_TOMCAT_HELLOWORLD \ + --slot staging + az webapp show --name $APPSERVICE_TOMCAT_HELLOWORLD \ + --resource-group $RESOURCE_GROUP \ + --query=defaultHostName + az webapp deployment slot list --name $APPSERVICE_TOMCAT_HELLOWORLD \ + --resource-group $RESOURCE_GROUP \ + --query='[0].defaultHostName' + + cd appservice/deploy-to-deployment-slot + + mvn clean install + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_TOMCAT_HELLOWORLD \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP \ + -DdeploymentSlotName=staging + + sleep 60 + cd ../.. + + + export RESULT=$(az webapp deployment slot list --resource-group $RESOURCE_GROUP --name $APPSERVICE_TOMCAT_HELLOWORLD --output tsv --query '[0].state') + if [[ "$RESULT" != Running ]]; then + echo 'Deployment slot is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + sleep 60 + export URL=https://$(az webapp deployment slot list --resource-group $RESOURCE_GROUP --name $APPSERVICE_TOMCAT_HELLOWORLD --output tsv --query '[0].defaultHostName') + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello Staging"* ]]; then + echo "Response did not contain 'Hello Staging'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_docker-tomcat_README_md.yml b/.github/workflows/appservice_docker-tomcat_README_md.yml new file mode 100644 index 00000000..994a7287 --- /dev/null +++ b/.github/workflows/appservice_docker-tomcat_README_md.yml @@ -0,0 +1,154 @@ +on: + schedule: + - cron: '0 4 * * 4' + workflow_dispatch: + +name: 'appservice/docker-tomcat/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/tomcat + + mvn package + export ACR_TOMCAT_IMAGE=tomcat:latest + + az acr build --registry $ACR_NAME --image $ACR_TOMCAT_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/create-settings-xml + + export ACR_USERNAME=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query username --output tsv` + export ACR_PASSWORD=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query 'passwords[0].value' --output tsv` + export SETTINGS_XML=$PWD/settings.xml + + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/docker-tomcat + + export APPSERVICE_DOCKER_TOMCAT=appservice-docker-tomcat-$RANDOM + + mvn azure-webapp:deploy \ + --settings=$SETTINGS_XML \ + -DappName=$APPSERVICE_DOCKER_TOMCAT \ + -DimageName=$ACR_TOMCAT_IMAGE \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP \ + -DserverId=$ACR_NAME + + az webapp show \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_DOCKER_TOMCAT \ + --query 'hostNames[0]' \ + --output tsv + + sleep 180 + cd ../.. + + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_DOCKER_TOMCAT --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_DOCKER_TOMCAT --output tsv --query defaultHostName) + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"custom Tomcat"* ]]; then + echo "Response did not contain 'custom Tomcat'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_docker-wildfly_README_md.yml b/.github/workflows/appservice_docker-wildfly_README_md.yml new file mode 100644 index 00000000..2aa96e3e --- /dev/null +++ b/.github/workflows/appservice_docker-wildfly_README_md.yml @@ -0,0 +1,154 @@ +on: + schedule: + - cron: '0 3 * * 4' + workflow_dispatch: + +name: 'appservice/docker-wildfly/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/wildfly + + mvn package + export ACR_WILDFLY_IMAGE=wildfly:latest + + az acr build --registry $ACR_NAME --image $ACR_WILDFLY_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/create-settings-xml + + export ACR_USERNAME=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query username --output tsv` + export ACR_PASSWORD=`az acr credential show --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP --query 'passwords[0].value' --output tsv` + export SETTINGS_XML=$PWD/settings.xml + + cd ../.. + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/docker-wildfly + + export APPSERVICE_DOCKER_WILDFLY=appservice-docker-wildfly-$RANDOM + + mvn azure-webapp:deploy \ + --settings=$SETTINGS_XML \ + -DappName=$APPSERVICE_DOCKER_WILDFLY \ + -DimageName=$ACR_WILDFLY_IMAGE \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP \ + -DserverId=$ACR_NAME + + az webapp show \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_DOCKER_WILDFLY \ + --query hostNames[0] \ + --output tsv + + sleep 60 + cd ../../.. + + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_DOCKER_WILDFLY --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_DOCKER_WILDFLY --output tsv --query defaultHostName) + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"custom WildFly"* ]]; then + echo "Response did not contain 'custom WildFly'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_java-springboot-github-actions_README_md.yml b/.github/workflows/appservice_java-springboot-github-actions_README_md.yml new file mode 100644 index 00000000..a1e67efa --- /dev/null +++ b/.github/workflows/appservice_java-springboot-github-actions_README_md.yml @@ -0,0 +1,18 @@ +on: + workflow_dispatch: + +name: 'appservice/java-springboot-github-actions/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_javase-quarkus_README_md.yml b/.github/workflows/appservice_javase-quarkus_README_md.yml new file mode 100644 index 00000000..274aec29 --- /dev/null +++ b/.github/workflows/appservice_javase-quarkus_README_md.yml @@ -0,0 +1,80 @@ +on: + schedule: + - cron: '0 2 * * 4' + workflow_dispatch: + +name: 'appservice/javase-quarkus/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/javase-quarkus + + mvn package + export APPSERVICE_JAVASE_QUARKUS=javazappsvc-javase-quarkus-$RANDOM + + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_JAVASE_QUARKUS \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + cd ../.. + + + sleep 120 + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JAVASE_QUARKUS --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + sleep 120 + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JAVASE_QUARKUS --output tsv --query defaultHostName) + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello"* ]]; then + echo "Response did not contain 'Hello'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_javase-springboot_README_md.yml b/.github/workflows/appservice_javase-springboot_README_md.yml new file mode 100644 index 00000000..d69c8e74 --- /dev/null +++ b/.github/workflows/appservice_javase-springboot_README_md.yml @@ -0,0 +1,81 @@ +on: + schedule: + - cron: '0 1 * * 4' + workflow_dispatch: + +name: 'appservice/javase-springboot/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/javase-springboot + + mvn package + export APPSERVICE_JAVASE_SPRINGBOOT=javazappsvc-javase-springboot-$RANDOM + + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_JAVASE_SPRINGBOOT \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 240 + cd ../.. + + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JAVASE_SPRINGBOOT --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JAVASE_SPRINGBOOT --output tsv --query defaultHostName) + export RESULT=$(curl $URL) + sleep 240 + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello World"* ]]; then + echo "Response did not contain 'Hello World'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_jboss-eap-helloworld_README_md.yml b/.github/workflows/appservice_jboss-eap-helloworld_README_md.yml new file mode 100644 index 00000000..43c36a4b --- /dev/null +++ b/.github/workflows/appservice_jboss-eap-helloworld_README_md.yml @@ -0,0 +1,79 @@ +on: + schedule: + - cron: '0 0 * * 4' + workflow_dispatch: + +name: 'appservice/jboss-eap-helloworld/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/jboss-eap-helloworld + + mvn clean package + export APPSERVICE_JBOSS_EAP_HELLOWORLD=appservice-jboss-eap-helloworld-$RANDOM + + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_JBOSS_EAP_HELLOWORLD \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 240 + cd ../.. + + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JBOSS_EAP_HELLOWORLD --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JBOSS_EAP_HELLOWORLD --output tsv --query defaultHostName) + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello World"* ]]; then + echo "Response did not contain 'Hello World'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_list-webapp_README_md.yml b/.github/workflows/appservice_list-webapp_README_md.yml new file mode 100644 index 00000000..e0d48b94 --- /dev/null +++ b/.github/workflows/appservice_list-webapp_README_md.yml @@ -0,0 +1,70 @@ +on: + schedule: + - cron: '0 23 * * 3' + workflow_dispatch: + +name: 'appservice/list-webapp/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/tomcat-helloworld + + mvn clean install + export APPSERVICE_TOMCAT_HELLOWORLD=appservice-tomcat-helloworld-$RANDOM + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_TOMCAT_HELLOWORLD \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 60 + cd ../.. + + az webapp list --resource-group $RESOURCE_GROUP +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_scale-manually_README_md.yml b/.github/workflows/appservice_scale-manually_README_md.yml new file mode 100644 index 00000000..86d4ea37 --- /dev/null +++ b/.github/workflows/appservice_scale-manually_README_md.yml @@ -0,0 +1,80 @@ +on: + schedule: + - cron: '0 22 * * 3' + workflow_dispatch: + +name: 'appservice/scale-manually/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/tomcat-helloworld + + mvn clean install + export APPSERVICE_TOMCAT_HELLOWORLD=appservice-tomcat-helloworld-$RANDOM + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_TOMCAT_HELLOWORLD \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 60 + cd ../.. + + az appservice plan update \ + --verbose \ + --name $APPSERVICE_PLAN \ + --resource-group $RESOURCE_GROUP \ + --number-of-workers 2 + + export RESULT=$(az appservice plan show --name $APPSERVICE_PLAN --resource-group $RESOURCE_GROUP --output tsv --query sku.capacity) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != "2" ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_swap-deployment-slot_README_md.yml b/.github/workflows/appservice_swap-deployment-slot_README_md.yml new file mode 100644 index 00000000..a15de528 --- /dev/null +++ b/.github/workflows/appservice_swap-deployment-slot_README_md.yml @@ -0,0 +1,120 @@ +on: + schedule: + - cron: '0 21 * * 3' + workflow_dispatch: + +name: 'appservice/swap-deployment-slot/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/tomcat-helloworld + + mvn clean install + export APPSERVICE_TOMCAT_HELLOWORLD=appservice-tomcat-helloworld-$RANDOM + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_TOMCAT_HELLOWORLD \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 60 + cd ../.. + + az webapp deployment slot create \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_TOMCAT_HELLOWORLD \ + --slot staging + az webapp show --name $APPSERVICE_TOMCAT_HELLOWORLD \ + --resource-group $RESOURCE_GROUP \ + --query=defaultHostName + az webapp deployment slot list --name $APPSERVICE_TOMCAT_HELLOWORLD \ + --resource-group $RESOURCE_GROUP \ + --query='[0].defaultHostName' + + cd appservice/deploy-to-deployment-slot + + mvn clean install + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_TOMCAT_HELLOWORLD \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP \ + -DdeploymentSlotName=staging + + sleep 60 + cd ../.. + + az webapp deployment slot swap \ + --resource-group $RESOURCE_GROUP \ + --name $APPSERVICE_TOMCAT_HELLOWORLD \ + --slot staging + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_TOMCAT_HELLOWORLD --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_TOMCAT_HELLOWORLD --output tsv --query defaultHostName) + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello Staging"* ]]; then + echo "Response did not contain 'Hello Staging'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/appservice_tomcat-helloworld_README_md.yml b/.github/workflows/appservice_tomcat-helloworld_README_md.yml new file mode 100644 index 00000000..0a4c69bd --- /dev/null +++ b/.github/workflows/appservice_tomcat-helloworld_README_md.yml @@ -0,0 +1,78 @@ +on: + schedule: + - cron: '0 20 * * 3' + workflow_dispatch: + +name: 'appservice/tomcat-helloworld/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $APPSERVICE_PLAN ]]; then + export APPSERVICE_PLAN=joaz-asp-$RANDOM + fi + + az appservice plan create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --name $APPSERVICE_PLAN \ + --is-linux \ + --sku P1v3 + + cd appservice/tomcat-helloworld + + mvn clean install + export APPSERVICE_TOMCAT_HELLOWORLD=appservice-tomcat-helloworld-$RANDOM + mvn azure-webapp:deploy \ + -DappName=$APPSERVICE_TOMCAT_HELLOWORLD \ + -DappServicePlan=$APPSERVICE_PLAN \ + -DresourceGroup=$RESOURCE_GROUP + + sleep 60 + cd ../.. + + + export RESULT=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_TOMCAT_HELLOWORLD --output tsv --query state) + if [[ "$RESULT" != Running ]]; then + echo 'Web application is NOT running' + az group delete --name $RESOURCE_GROUP --yes || true + exit 1 + fi + export URL=https://$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_TOMCAT_HELLOWORLD --output tsv --query defaultHostName) + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello World"* ]]; then + echo "Response did not contain 'Hello World'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/aro_README_md.yml b/.github/workflows/aro_README_md.yml new file mode 100644 index 00000000..cfc7c890 --- /dev/null +++ b/.github/workflows/aro_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'aro/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/aro_create_README_md.yml b/.github/workflows/aro_create_README_md.yml new file mode 100644 index 00000000..bd437a5e --- /dev/null +++ b/.github/workflows/aro_create_README_md.yml @@ -0,0 +1,68 @@ +on: + workflow_dispatch: + +name: 'aro/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export ARO_NAME=aro-$RANDOM + + az network vnet create \ + --resource-group $RESOURCE_GROUP \ + --name aro-vnet \ + --address-prefixes 10.0.0.0/22 + + az network vnet subnet create \ + --resource-group $RESOURCE_GROUP \ + --vnet-name aro-vnet \ + --name aro-master-subnet \ + --address-prefixes 10.0.0.0/23 \ + --service-endpoints Microsoft.ContainerRegistry + + az network vnet subnet create \ + --resource-group $RESOURCE_GROUP \ + --vnet-name aro-vnet \ + --name aro-worker-subnet \ + --address-prefixes 10.0.2.0/23 \ + --service-endpoints Microsoft.ContainerRegistry + + az network vnet subnet update \ + --name aro-master-subnet \ + --resource-group $RESOURCE_GROUP \ + --vnet-name aro-vnet \ + --disable-private-link-service-network-policies true + + az aro create \ + --name $ARO_NAME \ + --resource-group $RESOURCE_GROUP \ + --master-subnet aro-master-subnet \ + --worker-subnet aro-worker-subnet \ + --vnet aro-vnet + + export RESULT=$(az aro show --name $ARO_NAME --resource-group $RESOURCE_GROUP --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Azure RedHat OpenShift cluster " $ARO_NAME " was not created successfully" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cognitiveservices_README_md.yml b/.github/workflows/cognitiveservices_README_md.yml new file mode 100644 index 00000000..81f8c9b3 --- /dev/null +++ b/.github/workflows/cognitiveservices_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'cognitiveservices/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cognitiveservices_chat-with-semantic-kernel-and-gpt35_README_md.yml b/.github/workflows/cognitiveservices_chat-with-semantic-kernel-and-gpt35_README_md.yml new file mode 100644 index 00000000..28c904e7 --- /dev/null +++ b/.github/workflows/cognitiveservices_chat-with-semantic-kernel-and-gpt35_README_md.yml @@ -0,0 +1,117 @@ +on: + schedule: + - cron: '0 19 * * 3' + workflow_dispatch: + +name: 'cognitiveservices/chat-with-semantic-kernel-and-gpt35/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=eastus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $REGION ]]; then + export REGION=eastus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export COG_AZURE_OPENAI_NAME=cog-$RANDOM + + az cognitiveservices account create \ + --name $COG_AZURE_OPENAI_NAME \ + --resource-group $RESOURCE_GROUP \ + --location eastus \ + --kind OpenAI \ + --sku S0 \ + --yes + + if [[ -z $REGION ]]; then + export REGION=eastus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $REGION ]]; then + export REGION=eastus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export COG_AZURE_OPENAI_NAME=cog-$RANDOM + + az cognitiveservices account create \ + --name $COG_AZURE_OPENAI_NAME \ + --resource-group $RESOURCE_GROUP \ + --location eastus \ + --kind OpenAI \ + --sku S0 \ + --yes + az cognitiveservices account deployment create \ + --name $COG_AZURE_OPENAI_NAME \ + --resource-group $RESOURCE_GROUP \ + --deployment-name gpt-35-turbo \ + --model-name gpt-35-turbo \ + --model-version "0613" \ + --model-format OpenAI \ + --sku-capacity "1" \ + --sku-name "Standard" + export OPENAI_CLIENT_TYPE=AZURE_OPEN_AI + export AZURE_OPEN_AI_KEY=$(az cognitiveservices account keys list --name $COG_AZURE_OPENAI_NAME --resource-group $RESOURCE_GROUP --output tsv --query key1) + export AZURE_OPEN_AI_ENDPOINT=$(az cognitiveservices account show --name $COG_AZURE_OPENAI_NAME --resource-group $RESOURCE_GROUP --output tsv --query properties.endpoint) + mvn clean package + + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cognitiveservices_create-gpt35-model_README_md.yml b/.github/workflows/cognitiveservices_create-gpt35-model_README_md.yml new file mode 100644 index 00000000..bbf56baf --- /dev/null +++ b/.github/workflows/cognitiveservices_create-gpt35-model_README_md.yml @@ -0,0 +1,75 @@ +on: + schedule: + - cron: '0 18 * * 3' + workflow_dispatch: + +name: 'cognitiveservices/create-gpt35-model/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=eastus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $REGION ]]; then + export REGION=eastus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export COG_AZURE_OPENAI_NAME=cog-$RANDOM + + az cognitiveservices account create \ + --name $COG_AZURE_OPENAI_NAME \ + --resource-group $RESOURCE_GROUP \ + --location eastus \ + --kind OpenAI \ + --sku S0 \ + --yes + az cognitiveservices account deployment create \ + --name $COG_AZURE_OPENAI_NAME \ + --resource-group $RESOURCE_GROUP \ + --deployment-name gpt-35-turbo \ + --model-name gpt-35-turbo \ + --model-version "0613" \ + --model-format OpenAI \ + --sku-capacity "1" \ + --sku-name "Standard" + + export RESULT=$(az cognitiveservices account deployment show --name $COG_AZURE_OPENAI_NAME --deployment-name gpt-35-turbo --resource-group $RESOURCE_GROUP --output tsv --query properties.provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Azure OpenAI GPT 3.5 model was not created successfully" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cognitiveservices_create-openai-account_README_md.yml b/.github/workflows/cognitiveservices_create-openai-account_README_md.yml new file mode 100644 index 00000000..86e3b4bf --- /dev/null +++ b/.github/workflows/cognitiveservices_create-openai-account_README_md.yml @@ -0,0 +1,51 @@ +on: + schedule: + - cron: '0 17 * * 3' + workflow_dispatch: + +name: 'cognitiveservices/create-openai-account/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=eastus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export COG_AZURE_OPENAI_NAME=cog-$RANDOM + + az cognitiveservices account create \ + --name $COG_AZURE_OPENAI_NAME \ + --resource-group $RESOURCE_GROUP \ + --location eastus \ + --kind OpenAI \ + --sku S0 \ + --yes + + export RESULT=$(az cognitiveservices account show --name $COG_AZURE_OPENAI_NAME --resource-group $RESOURCE_GROUP --output tsv --query properties.provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Azure OpenAI account " $COG_AZURE_OPENAI_NAME " was not created successfully" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/container_README_md.yml b/.github/workflows/container_README_md.yml new file mode 100644 index 00000000..a546bac0 --- /dev/null +++ b/.github/workflows/container_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'container/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/container_quarkus_README_md.yml b/.github/workflows/container_quarkus_README_md.yml new file mode 100644 index 00000000..52fe2f95 --- /dev/null +++ b/.github/workflows/container_quarkus_README_md.yml @@ -0,0 +1,89 @@ +on: + schedule: + - cron: '0 16 * * 3' + workflow_dispatch: + +name: 'container/quarkus/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/quarkus + + mvn -ntp package + export ACR_QUARKUS_IMAGE=quarkus:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_QUARKUS_IMAGE . + + cd ../.. +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/container_tomcat_README_md.yml b/.github/workflows/container_tomcat_README_md.yml new file mode 100644 index 00000000..0e2e4849 --- /dev/null +++ b/.github/workflows/container_tomcat_README_md.yml @@ -0,0 +1,85 @@ +on: + schedule: + - cron: '0 15 * * 3' + workflow_dispatch: + +name: 'container/tomcat/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/tomcat + + mvn package + export ACR_TOMCAT_IMAGE=tomcat:latest + + az acr build --registry $ACR_NAME --image $ACR_TOMCAT_IMAGE . + + cd ../.. +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/container_wildfly_README_md.yml b/.github/workflows/container_wildfly_README_md.yml new file mode 100644 index 00000000..fe5e124c --- /dev/null +++ b/.github/workflows/container_wildfly_README_md.yml @@ -0,0 +1,88 @@ +on: + schedule: + - cron: '0 14 * * 3' + workflow_dispatch: + +name: 'container/wildfly/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/wildfly + + mvn package + export ACR_WILDFLY_IMAGE=wildfly:latest + + az acr build --registry $ACR_NAME --image $ACR_WILDFLY_IMAGE . + + cd ../.. + + + sleep 60 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/containerapp_create-manual-job_README_md.yml b/.github/workflows/containerapp_create-manual-job_README_md.yml new file mode 100644 index 00000000..7f44e887 --- /dev/null +++ b/.github/workflows/containerapp_create-manual-job_README_md.yml @@ -0,0 +1,107 @@ +on: + schedule: + - cron: '0 12 * * 3' + workflow_dispatch: + +name: 'containerapp/create-manual-job/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add --name containerapp --upgrade + az provider register --namespace Microsoft.App + az provider register --namespace Microsoft.OperationalInsights + + if [[ -z $ACA_ENVIRONMENT_NAME ]]; then + export ACA_ENVIRONMENT_NAME=joazaca$RANDOM + export ACA_REGION=westus + fi + + + az containerapp env create \ + --name $ACA_ENVIRONMENT_NAME \ + --resource-group $RESOURCE_GROUP \ + --location "$ACA_REGION" || true + + sleep 60 + + if [[ -z $ACA_JOB_NAME ]]; then + export ACA_JOB_NAME=aca-job-$RANDOM + sleep 60 + fi + az containerapp job create \ + --name $ACA_JOB_NAME \ + --resource-group $RESOURCE_GROUP \ + --environment $ACA_ENVIRONMENT_NAME \ + --trigger-type Manual \ + --replica-timeout 1800 \ + --replica-retry-limit 1 \ + --replica-completion-count 1 \ + --parallelism 1 \ + --registry-identity system \ + --registry-server $ACR_NAME.azurecr.io \ + --image $ACR_NAME.azurecr.io/$ACR_HELLOWORLDJOB_IMAGE + + export RESULT=$(az containerapp job show --name $ACA_JOB_NAME --resource-group $RESOURCE_GROUP --output tsv --query properties.provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Azure Container Apps job $ACA_JOB_NAME was not provisioned properly" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/containerapp_dropwizard_README_md.yml b/.github/workflows/containerapp_dropwizard_README_md.yml new file mode 100644 index 00000000..40f8ccd5 --- /dev/null +++ b/.github/workflows/containerapp_dropwizard_README_md.yml @@ -0,0 +1,106 @@ +on: + schedule: + - cron: '0 15 * * 3' + workflow_dispatch: + +name: 'containerapp/dropwizard/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/dropwizard + + mvn package + export ACR_DROPWIZARD_IMAGE=dropwizard:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_DROPWIZARD_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add --name containerapp --upgrade + az provider register --namespace Microsoft.App + az provider register --namespace Microsoft.OperationalInsights + + if [[ -z $ACA_ENVIRONMENT_NAME ]]; then + export ACA_ENVIRONMENT_NAME=joazaca$RANDOM + export ACA_REGION=westus + fi + + + az containerapp env create \ + --name $ACA_ENVIRONMENT_NAME \ + --resource-group $RESOURCE_GROUP \ + --location "$ACA_REGION" || true + + sleep 60 + + export ACA_DROPWIZARD=dropwizard + + az containerapp create \ + --name $ACA_DROPWIZARD \ + --resource-group $RESOURCE_GROUP \ + --environment $ACA_ENVIRONMENT_NAME \ + --image $ACR_NAME.azurecr.io/$ACR_DROPWIZARD_IMAGE \ + --target-port 8080 \ + --ingress 'external' \ + --registry-server $ACR_NAME.azurecr.io \ + --min-replicas 1 + + echo $(az containerapp show \ + --resource-group $RESOURCE_GROUP \ + --name $ACA_DROPWIZARD \ + --query properties.configuration.ingress.fqdn \ + --output tsv)/helloworld + + sleep 60 + export URL=https://$(az containerapp show --resource-group $RESOURCE_GROUP --name $ACA_DROPWIZARD --query properties.configuration.ingress.fqdn --output tsv)/helloworld + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello World"* ]]; then + echo "Response did not contain 'Hello World'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/containerapp_execute-manual-job_README_md.yml b/.github/workflows/containerapp_execute-manual-job_README_md.yml new file mode 100644 index 00000000..fc10f8d3 --- /dev/null +++ b/.github/workflows/containerapp_execute-manual-job_README_md.yml @@ -0,0 +1,143 @@ +on: + schedule: + - cron: '0 10 * * 3' + workflow_dispatch: + +name: 'containerapp/execute-manual-job/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add --name containerapp --upgrade + az provider register --namespace Microsoft.App + az provider register --namespace Microsoft.OperationalInsights + + if [[ -z $ACA_ENVIRONMENT_NAME ]]; then + export ACA_ENVIRONMENT_NAME=joazaca$RANDOM + export ACA_REGION=westus + fi + + + az containerapp env create \ + --name $ACA_ENVIRONMENT_NAME \ + --resource-group $RESOURCE_GROUP \ + --location "$ACA_REGION" || true + + sleep 60 + + if [[ -z $ACA_JOB_NAME ]]; then + export ACA_JOB_NAME=aca-job-$RANDOM + sleep 60 + fi + az containerapp job create \ + --name $ACA_JOB_NAME \ + --resource-group $RESOURCE_GROUP \ + --environment $ACA_ENVIRONMENT_NAME \ + --trigger-type Manual \ + --replica-timeout 1800 \ + --replica-retry-limit 1 \ + --replica-completion-count 1 \ + --parallelism 1 \ + --registry-identity system \ + --registry-server $ACR_NAME.azurecr.io \ + --image $ACR_NAME.azurecr.io/$ACR_HELLOWORLDJOB_IMAGE + az containerapp job start \ + --name $ACA_JOB_NAME \ + --resource-group $RESOURCE_GROUP + + sleep 60 + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/containerapp_get-job-execution-log_README_md.yml b/.github/workflows/containerapp_get-job-execution-log_README_md.yml new file mode 100644 index 00000000..269dbaec --- /dev/null +++ b/.github/workflows/containerapp_get-job-execution-log_README_md.yml @@ -0,0 +1,229 @@ +on: + schedule: + - cron: '0 9 * * 3' + workflow_dispatch: + +name: 'containerapp/get-job-execution-log/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add --name containerapp --upgrade + az provider register --namespace Microsoft.App + az provider register --namespace Microsoft.OperationalInsights + + if [[ -z $ACA_ENVIRONMENT_NAME ]]; then + export ACA_ENVIRONMENT_NAME=joazaca$RANDOM + export ACA_REGION=westus + fi + + + az containerapp env create \ + --name $ACA_ENVIRONMENT_NAME \ + --resource-group $RESOURCE_GROUP \ + --location "$ACA_REGION" || true + + sleep 60 + + if [[ -z $ACA_JOB_NAME ]]; then + export ACA_JOB_NAME=aca-job-$RANDOM + sleep 60 + fi + az containerapp job create \ + --name $ACA_JOB_NAME \ + --resource-group $RESOURCE_GROUP \ + --environment $ACA_ENVIRONMENT_NAME \ + --trigger-type Manual \ + --replica-timeout 1800 \ + --replica-retry-limit 1 \ + --replica-completion-count 1 \ + --parallelism 1 \ + --registry-identity system \ + --registry-server $ACR_NAME.azurecr.io \ + --image $ACR_NAME.azurecr.io/$ACR_HELLOWORLDJOB_IMAGE + az containerapp job start \ + --name $ACA_JOB_NAME \ + --resource-group $RESOURCE_GROUP + az containerapp job execution list \ + --name $ACA_JOB_NAME \ + --resource-group $RESOURCE_GROUP + export ACA_LOG_ANALYTICS_WORKSPACE_ID=`az containerapp env show \ + --name $ACA_ENVIRONMENT_NAME \ + --resource-group $RESOURCE_GROUP \ + --query "properties.appLogsConfiguration.logAnalyticsConfiguration.customerId" \ + --output tsv` + export ACA_JOB_EXECUTION_NAME=`az containerapp job execution list \ + --name $ACA_JOB_NAME \ + --resource-group $RESOURCE_GROUP \ + --query "[0].name" \ + --output tsv` + + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/containerapp_helidon_README_md.yml b/.github/workflows/containerapp_helidon_README_md.yml new file mode 100644 index 00000000..a5788330 --- /dev/null +++ b/.github/workflows/containerapp_helidon_README_md.yml @@ -0,0 +1,111 @@ +on: + schedule: + - cron: '0 7 * * 3' + workflow_dispatch: + +name: 'containerapp/helidon/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helidon + + mvn package + export ACR_HELIDON_IMAGE=helidon:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELIDON_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add --name containerapp --upgrade + az provider register --namespace Microsoft.App + az provider register --namespace Microsoft.OperationalInsights + + if [[ -z $ACA_ENVIRONMENT_NAME ]]; then + export ACA_ENVIRONMENT_NAME=joazaca$RANDOM + export ACA_REGION=westus + fi + + + az containerapp env create \ + --name $ACA_ENVIRONMENT_NAME \ + --resource-group $RESOURCE_GROUP \ + --location "$ACA_REGION" || true + + sleep 60 + + export ACA_HELIDON=helidon + + az containerapp create \ + --name $ACA_HELIDON \ + --resource-group $RESOURCE_GROUP \ + --environment $ACA_ENVIRONMENT_NAME \ + --image $ACR_NAME.azurecr.io/$ACR_HELIDON_IMAGE \ + --target-port 8080 \ + --ingress 'external' \ + --registry-server $ACR_NAME.azurecr.io \ + --min-replicas 1 + + echo $(az containerapp show \ + --resource-group $RESOURCE_GROUP \ + --name $ACA_HELIDON \ + --query properties.configuration.ingress.fqdn \ + --output tsv)/greet + + sleep 60 + export URL=https://$(az containerapp show --resource-group $RESOURCE_GROUP --name $ACA_HELIDON --query properties.configuration.ingress.fqdn --output tsv)/greet + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello World"* ]]; then + echo "Response did not contain 'Hello World'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/containerapp_list-job-executions_README_md.yml b/.github/workflows/containerapp_list-job-executions_README_md.yml new file mode 100644 index 00000000..7a66961b --- /dev/null +++ b/.github/workflows/containerapp_list-job-executions_README_md.yml @@ -0,0 +1,183 @@ +on: + schedule: + - cron: '0 6 * * 3' + workflow_dispatch: + +name: 'containerapp/list-job-executions/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $ACR_NAME ]]; then + export ACR_NAME=joazcr$RANDOM + fi + + az acr create \ + --name $ACR_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --admin-enabled true + + cd acr/helloworldjob + + mvn -ntp package + export ACR_HELLOWORLDJOB_IMAGE=helloworldjob:latest + + az acr build --registry $ACR_NAME --resource-group $RESOURCE_GROUP --image $ACR_HELLOWORLDJOB_IMAGE . + + cd ../.. + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add --name containerapp --upgrade + az provider register --namespace Microsoft.App + az provider register --namespace Microsoft.OperationalInsights + + if [[ -z $ACA_ENVIRONMENT_NAME ]]; then + export ACA_ENVIRONMENT_NAME=joazaca$RANDOM + export ACA_REGION=westus + fi + + + az containerapp env create \ + --name $ACA_ENVIRONMENT_NAME \ + --resource-group $RESOURCE_GROUP \ + --location "$ACA_REGION" || true + + sleep 60 + + if [[ -z $ACA_JOB_NAME ]]; then + export ACA_JOB_NAME=aca-job-$RANDOM + sleep 60 + fi + az containerapp job create \ + --name $ACA_JOB_NAME \ + --resource-group $RESOURCE_GROUP \ + --environment $ACA_ENVIRONMENT_NAME \ + --trigger-type Manual \ + --replica-timeout 1800 \ + --replica-retry-limit 1 \ + --replica-completion-count 1 \ + --parallelism 1 \ + --registry-identity system \ + --registry-server $ACR_NAME.azurecr.io \ + --image $ACR_NAME.azurecr.io/$ACR_HELLOWORLDJOB_IMAGE + az containerapp job start \ + --name $ACA_JOB_NAME \ + --resource-group $RESOURCE_GROUP + az containerapp job execution list \ + --name $ACA_JOB_NAME \ + --resource-group $RESOURCE_GROUP + + sleep 60 + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cosmosdb_README_md.yml b/.github/workflows/cosmosdb_README_md.yml new file mode 100644 index 00000000..55c5325c --- /dev/null +++ b/.github/workflows/cosmosdb_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'cosmosdb/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cosmosdb_create-sql-container_README_md.yml b/.github/workflows/cosmosdb_create-sql-container_README_md.yml new file mode 100644 index 00000000..5f744609 --- /dev/null +++ b/.github/workflows/cosmosdb_create-sql-container_README_md.yml @@ -0,0 +1,71 @@ +on: + schedule: + - cron: '0 22 * * 2' + workflow_dispatch: + +name: 'cosmosdb/create-sql-container/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then + export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM + az cosmosdb create \ + --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --locations regionName=eastus failoverPriority=0 + fi + + + if [[ -z $COSMOSDB_SQL_DATABASE ]]; then + export COSMOSDB_SQL_DATABASE=sql-database-$RANDOM + az cosmosdb sql database create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --name $COSMOSDB_SQL_DATABASE + fi + + + if [[ -z $COSMOSDB_SQL_CONTAINER ]]; then + export COSMOSDB_SQL_CONTAINER=sql-container-$RANDOM + az cosmosdb sql container create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --database-name $COSMOSDB_SQL_DATABASE \ + --name $COSMOSDB_SQL_CONTAINER \ + --partition-key-path '/id' + fi + + + export RESULT=$(az cosmosdb sql container show \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --database-name $COSMOSDB_SQL_DATABASE \ + --name $COSMOSDB_SQL_CONTAINER \ + --output tsv --query id) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" == "" ]]; then + echo "Failed to create CosmosDB SQL container $COSMOSDB_SQL_CONTAINER" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cosmosdb_create-sql-database_README_md.yml b/.github/workflows/cosmosdb_create-sql-database_README_md.yml new file mode 100644 index 00000000..fda0cbb7 --- /dev/null +++ b/.github/workflows/cosmosdb_create-sql-database_README_md.yml @@ -0,0 +1,59 @@ +on: + schedule: + - cron: '0 21 * * 2' + workflow_dispatch: + +name: 'cosmosdb/create-sql-database/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then + export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM + az cosmosdb create \ + --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --locations regionName=eastus failoverPriority=0 + fi + + + if [[ -z $COSMOSDB_SQL_DATABASE ]]; then + export COSMOSDB_SQL_DATABASE=sql-database-$RANDOM + az cosmosdb sql database create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --name $COSMOSDB_SQL_DATABASE + fi + + + export RESULT=$(az cosmosdb sql database show \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --name $COSMOSDB_SQL_DATABASE \ + --output tsv --query id) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" == "" ]]; then + echo "Failed to create CosmosDB SQL database $COSMOSDB_SQL_DATABASE" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cosmosdb_create-sql-leases-container_README_md.yml b/.github/workflows/cosmosdb_create-sql-leases-container_README_md.yml new file mode 100644 index 00000000..63fb2712 --- /dev/null +++ b/.github/workflows/cosmosdb_create-sql-leases-container_README_md.yml @@ -0,0 +1,71 @@ +on: + schedule: + - cron: '0 20 * * 2' + workflow_dispatch: + +name: 'cosmosdb/create-sql-leases-container/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then + export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM + az cosmosdb create \ + --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --locations regionName=eastus failoverPriority=0 + fi + + + if [[ -z $COSMOSDB_SQL_DATABASE ]]; then + export COSMOSDB_SQL_DATABASE=sql-database-$RANDOM + az cosmosdb sql database create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --name $COSMOSDB_SQL_DATABASE + fi + + + if [[ -z $COSMOSDB_SQL_LEASES_CONTAINER ]]; then + export COSMOSDB_SQL_LEASES_CONTAINER=sql-leases-$RANDOM + az cosmosdb sql container create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --database-name $COSMOSDB_SQL_DATABASE \ + --name $COSMOSDB_SQL_LEASES_CONTAINER \ + --partition-key-path '/id' + fi + + + export RESULT=$(az cosmosdb sql container show \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --database-name $COSMOSDB_SQL_DATABASE \ + --name $COSMOSDB_SQL_LEASES_CONTAINER \ + --output tsv --query id) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" == "" ]]; then + echo "Failed to create CosmosDB SQL leases container $COSMOSDB_SQL_CONTAINER" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cosmosdb_create_README_md.yml b/.github/workflows/cosmosdb_create_README_md.yml new file mode 100644 index 00000000..f90a3a38 --- /dev/null +++ b/.github/workflows/cosmosdb_create_README_md.yml @@ -0,0 +1,46 @@ +on: + schedule: + - cron: '0 23 * * 2' + workflow_dispatch: + +name: 'cosmosdb/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then + export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM + az cosmosdb create \ + --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --locations regionName=eastus failoverPriority=0 + fi + + + export RESULT=$(az cosmosdb show --name $COSMOSDB_ACCOUNT_NAME --resource-group $RESOURCE_GROUP --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Failed to create Cosmos DB account $COSMOSDB_ACCOUNT_NAME" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cosmosdb_insert-item-into-sql-container_README_md.yml b/.github/workflows/cosmosdb_insert-item-into-sql-container_README_md.yml new file mode 100644 index 00000000..31a6b17e --- /dev/null +++ b/.github/workflows/cosmosdb_insert-item-into-sql-container_README_md.yml @@ -0,0 +1,135 @@ +on: + schedule: + - cron: '0 19 * * 2' + workflow_dispatch: + +name: 'cosmosdb/insert-item-into-sql-container/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then + export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM + az cosmosdb create \ + --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --locations regionName=eastus failoverPriority=0 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then + export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM + az cosmosdb create \ + --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --locations regionName=eastus failoverPriority=0 + fi + + + if [[ -z $COSMOSDB_SQL_DATABASE ]]; then + export COSMOSDB_SQL_DATABASE=sql-database-$RANDOM + az cosmosdb sql database create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --name $COSMOSDB_SQL_DATABASE + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then + export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM + az cosmosdb create \ + --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --locations regionName=eastus failoverPriority=0 + fi + + + if [[ -z $COSMOSDB_SQL_DATABASE ]]; then + export COSMOSDB_SQL_DATABASE=sql-database-$RANDOM + az cosmosdb sql database create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --name $COSMOSDB_SQL_DATABASE + fi + + + if [[ -z $COSMOSDB_SQL_CONTAINER ]]; then + export COSMOSDB_SQL_CONTAINER=sql-container-$RANDOM + az cosmosdb sql container create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --database-name $COSMOSDB_SQL_DATABASE \ + --name $COSMOSDB_SQL_CONTAINER \ + --partition-key-path '/id' + fi + + + cd cosmosdb/insert-item-into-sql-container + + mvn clean install + export COSMOSDB_ENDPOINT=$(az cosmosdb show --resource-group $RESOURCE_GROUP \ + --name $COSMOSDB_ACCOUNT_NAME --output tsv --query documentEndpoint) + + export COSMOSDB_MASTER_KEY=$(az cosmosdb keys list --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP --output tsv --query primaryMasterKey) + + export RESULT=$(java -jar target/insert-item.jar) + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != "Item was added" ]]; then + echo "Failed to insert item into $COSMOSDB_SQL_CONTAINER" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/cosmosdb_sql-change-feed-processor_README_md.yml b/.github/workflows/cosmosdb_sql-change-feed-processor_README_md.yml new file mode 100644 index 00000000..248920ea --- /dev/null +++ b/.github/workflows/cosmosdb_sql-change-feed-processor_README_md.yml @@ -0,0 +1,117 @@ +on: + schedule: + - cron: '0 18 * * 2' + workflow_dispatch: + +name: 'cosmosdb/sql-change-feed-processor/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then + export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM + az cosmosdb create \ + --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --locations regionName=eastus failoverPriority=0 + fi + + + if [[ -z $COSMOSDB_SQL_DATABASE ]]; then + export COSMOSDB_SQL_DATABASE=sql-database-$RANDOM + az cosmosdb sql database create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --name $COSMOSDB_SQL_DATABASE + fi + + + if [[ -z $COSMOSDB_SQL_CONTAINER ]]; then + export COSMOSDB_SQL_CONTAINER=sql-container-$RANDOM + az cosmosdb sql container create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --database-name $COSMOSDB_SQL_DATABASE \ + --name $COSMOSDB_SQL_CONTAINER \ + --partition-key-path '/id' + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then + export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM + az cosmosdb create \ + --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --locations regionName=eastus failoverPriority=0 + fi + + + if [[ -z $COSMOSDB_SQL_DATABASE ]]; then + export COSMOSDB_SQL_DATABASE=sql-database-$RANDOM + az cosmosdb sql database create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --name $COSMOSDB_SQL_DATABASE + fi + + + if [[ -z $COSMOSDB_SQL_LEASES_CONTAINER ]]; then + export COSMOSDB_SQL_LEASES_CONTAINER=sql-leases-$RANDOM + az cosmosdb sql container create \ + --resource-group $RESOURCE_GROUP \ + --account-name $COSMOSDB_ACCOUNT_NAME \ + --database-name $COSMOSDB_SQL_DATABASE \ + --name $COSMOSDB_SQL_LEASES_CONTAINER \ + --partition-key-path '/id' + fi + + + cd cosmosdb/sql-change-feed-processor + + mvn clean install + export COSMOSDB_ENDPOINT=$(az cosmosdb show --resource-group $RESOURCE_GROUP \ + --name $COSMOSDB_ACCOUNT_NAME --output tsv --query documentEndpoint) + + export COSMOSDB_MASTER_KEY=$(az cosmosdb keys list --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP --output tsv --query primaryMasterKey) + + export RESULT=$(java -jar target/change-feed-processor.jar) + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != "Change feed was processed" ]]; then + echo "Failed to process SQL change feed" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/eventhubs_README_md.yml b/.github/workflows/eventhubs_README_md.yml new file mode 100644 index 00000000..676ba151 --- /dev/null +++ b/.github/workflows/eventhubs_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'eventhubs/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/eventhubs_create-eventhub_README_md.yml b/.github/workflows/eventhubs_create-eventhub_README_md.yml new file mode 100644 index 00000000..5c49b19a --- /dev/null +++ b/.github/workflows/eventhubs_create-eventhub_README_md.yml @@ -0,0 +1,59 @@ +on: + schedule: + - cron: '0 17 * * 2' + workflow_dispatch: + +name: 'eventhubs/create-eventhub/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export EVENTHUBS_NAMESPACE=eventhubs-$RANDOM + + az eventhubs namespace create \ + --name $EVENTHUBS_NAMESPACE \ + --resource-group $RESOURCE_GROUP \ + --location $REGION + export EVENTHUBS_EVENTHUB=eventhubs-hub-$RANDOM + + az eventhubs eventhub create \ + --name $EVENTHUBS_EVENTHUB \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $EVENTHUBS_NAMESPACE + + export RESULT=$(az eventhubs eventhub show --name $EVENTHUBS_EVENTHUB --namespace-name $EVENTHUBS_NAMESPACE --resource-group $RESOURCE_GROUP --output tsv --query status) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Active ]]; then + echo "Azure Event Hubs EventHub - $EVENTHUBS_EVENTHUB - was not provisioned properly" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/eventhubs_create-namespace_README_md.yml b/.github/workflows/eventhubs_create-namespace_README_md.yml new file mode 100644 index 00000000..d3f89cac --- /dev/null +++ b/.github/workflows/eventhubs_create-namespace_README_md.yml @@ -0,0 +1,43 @@ +on: + schedule: + - cron: '0 16 * * 2' + workflow_dispatch: + +name: 'eventhubs/create-namespace/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export EVENTHUBS_NAMESPACE=eventhubs-$RANDOM + + az eventhubs namespace create \ + --name $EVENTHUBS_NAMESPACE \ + --resource-group $RESOURCE_GROUP \ + --location $REGION + + export RESULT=$(az eventhubs namespace show --name $EVENTHUBS_NAMESPACE --resource-group $RESOURCE_GROUP --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Azure Event Hubs namespace - $EVENTHUBS_NAMESPACE - was not provisioned properly" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/eventhubs_receive-event_README_md.yml b/.github/workflows/eventhubs_receive-event_README_md.yml new file mode 100644 index 00000000..6811d47b --- /dev/null +++ b/.github/workflows/eventhubs_receive-event_README_md.yml @@ -0,0 +1,164 @@ +on: + schedule: + - cron: '0 15 * * 2' + workflow_dispatch: + +name: 'eventhubs/receive-event/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export EVENTHUBS_NAMESPACE=eventhubs-$RANDOM + + az eventhubs namespace create \ + --name $EVENTHUBS_NAMESPACE \ + --resource-group $RESOURCE_GROUP \ + --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export EVENTHUBS_NAMESPACE=eventhubs-$RANDOM + + az eventhubs namespace create \ + --name $EVENTHUBS_NAMESPACE \ + --resource-group $RESOURCE_GROUP \ + --location $REGION + export EVENTHUBS_EVENTHUB=eventhubs-hub-$RANDOM + + az eventhubs eventhub create \ + --name $EVENTHUBS_EVENTHUB \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $EVENTHUBS_NAMESPACE + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export EVENTHUBS_NAMESPACE=eventhubs-$RANDOM + + az eventhubs namespace create \ + --name $EVENTHUBS_NAMESPACE \ + --resource-group $RESOURCE_GROUP \ + --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export EVENTHUBS_NAMESPACE=eventhubs-$RANDOM + + az eventhubs namespace create \ + --name $EVENTHUBS_NAMESPACE \ + --resource-group $RESOURCE_GROUP \ + --location $REGION + export EVENTHUBS_EVENTHUB=eventhubs-hub-$RANDOM + + az eventhubs eventhub create \ + --name $EVENTHUBS_EVENTHUB \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $EVENTHUBS_NAMESPACE + export EVENTHUBS_EVENTHUB_CONNECTION_STRING=$(az eventhubs namespace authorization-rule keys list \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $EVENTHUBS_NAMESPACE \ + --name RootManageSharedAccessKey \ + --query primaryConnectionString \ + --output tsv) + + cd eventhubs/send-event + + mvn clean install + + export RESULT=$(java -jar target/send-event.jar) + cd ../.. + + + cd eventhubs/receive-event + + mvn clean install + + export RESULT=$(java -jar target/receive-event.jar) + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != 'Received: this is an event' ]]; then + echo "Error when receiving event from EventHub" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/eventhubs_send-event_README_md.yml b/.github/workflows/eventhubs_send-event_README_md.yml new file mode 100644 index 00000000..612f487b --- /dev/null +++ b/.github/workflows/eventhubs_send-event_README_md.yml @@ -0,0 +1,98 @@ +on: + schedule: + - cron: '0 14 * * 2' + workflow_dispatch: + +name: 'eventhubs/send-event/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export EVENTHUBS_NAMESPACE=eventhubs-$RANDOM + + az eventhubs namespace create \ + --name $EVENTHUBS_NAMESPACE \ + --resource-group $RESOURCE_GROUP \ + --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export EVENTHUBS_NAMESPACE=eventhubs-$RANDOM + + az eventhubs namespace create \ + --name $EVENTHUBS_NAMESPACE \ + --resource-group $RESOURCE_GROUP \ + --location $REGION + export EVENTHUBS_EVENTHUB=eventhubs-hub-$RANDOM + + az eventhubs eventhub create \ + --name $EVENTHUBS_EVENTHUB \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $EVENTHUBS_NAMESPACE + export EVENTHUBS_EVENTHUB_CONNECTION_STRING=$(az eventhubs namespace authorization-rule keys list \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $EVENTHUBS_NAMESPACE \ + --name RootManageSharedAccessKey \ + --query primaryConnectionString \ + --output tsv) + + cd eventhubs/send-event + + mvn clean install + + export RESULT=$(java -jar target/send-event.jar) + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != 'Event was sent successfully' ]]; then + echo "Error when sending event to EventHub" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/functionapp_README_md.yml b/.github/workflows/functionapp_README_md.yml new file mode 100644 index 00000000..ad8ecfbd --- /dev/null +++ b/.github/workflows/functionapp_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'functionapp/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/functionapp_cosmosdb-output_README_md.yml b/.github/workflows/functionapp_cosmosdb-output_README_md.yml new file mode 100644 index 00000000..516a5d9a --- /dev/null +++ b/.github/workflows/functionapp_cosmosdb-output_README_md.yml @@ -0,0 +1,80 @@ +on: + schedule: + - cron: '0 13 * * 2' + workflow_dispatch: + +name: 'functionapp/cosmosdb-output/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=eastus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + + curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg + sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg + sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list' + sudo apt-get update + sudo apt-get install azure-functions-core-tools-4 + func + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then + export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM + az cosmosdb create \ + --name $COSMOSDB_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --locations regionName=eastus failoverPriority=0 + fi + + + cd functionapp/cosmosdb-output + + export FUNCTIONS_COSMOSDB=functions-cosmosdb-$RANDOM + export FUNCTIONS_COSMOSDB_CONNECTION_STRING="$(az cosmosdb keys list --resource-group $RESOURCE_GROUP --name $COSMOSDB_ACCOUNT_NAME --type connection-strings --query 'connectionStrings[0].connectionString' --output tsv)" + mvn -P local validate + mvn -DresourceGroup=$RESOURCE_GROUP \ + -DappName=$FUNCTIONS_COSMOSDB \ + -Dregion=$REGION \ + package + + mvn -DappName=$FUNCTIONS_COSMOSDB \ + -Dregion=$REGION \ + -DresourceGroup=$RESOURCE_GROUP \ + -DcosmosDBConnectionString="$FUNCTIONS_COSMOSDB_CONNECTION_STRING" \ + -DpricingTier=P1V3 \ + clean package azure-functions:deploy + + + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/functionapp_helloworld_README_md.yml b/.github/workflows/functionapp_helloworld_README_md.yml new file mode 100644 index 00000000..2790d1c5 --- /dev/null +++ b/.github/workflows/functionapp_helloworld_README_md.yml @@ -0,0 +1,72 @@ +on: + schedule: + - cron: '0 12 * * 2' + workflow_dispatch: + +name: 'functionapp/helloworld/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=eastus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + + curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg + sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg + sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list' + sudo apt-get update + sudo apt-get install azure-functions-core-tools-4 + func + + + cd functionapp/helloworld + mkdir .mvn + echo "-ntp" > .mvn/maven.config + + export FUNCTIONAPP_HELLOWORLD=joaz-func-helloworld-$RANDOM + mvn -DappName=$FUNCTIONAPP_HELLOWORLD \ + -DresourceGroup=$RESOURCE_GROUP \ + -Dregion=$REGION \ + package + mvn -DappName=$FUNCTIONAPP_HELLOWORLD \ + -DresourceGroup=$RESOURCE_GROUP \ + -Dregion=$REGION \ + clean package azure-functions:deploy + echo https://`az functionapp show \ + --resource-group $RESOURCE_GROUP \ + --name $FUNCTIONAPP_HELLOWORLD \ + --query hostNames \ + --output tsv`/api/helloworld + + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/functionapp_install-tools_README_md.yml b/.github/workflows/functionapp_install-tools_README_md.yml new file mode 100644 index 00000000..3b3e77cf --- /dev/null +++ b/.github/workflows/functionapp_install-tools_README_md.yml @@ -0,0 +1,32 @@ +on: + schedule: + - cron: '0 5 * * 4' + workflow_dispatch: + +name: 'functionapp/install-tools/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + + curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg + sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg + sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list' + sudo apt-get update + sudo apt-get install azure-functions-core-tools-4 + func +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/group_README_md.yml b/.github/workflows/group_README_md.yml new file mode 100644 index 00000000..4e8a8873 --- /dev/null +++ b/.github/workflows/group_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'group/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/keyvault_README_md.yml b/.github/workflows/keyvault_README_md.yml new file mode 100644 index 00000000..9aa9ad31 --- /dev/null +++ b/.github/workflows/keyvault_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'keyvault/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/keyvault_add-secret_README_md.yml b/.github/workflows/keyvault_add-secret_README_md.yml new file mode 100644 index 00000000..bed2412e --- /dev/null +++ b/.github/workflows/keyvault_add-secret_README_md.yml @@ -0,0 +1,56 @@ +on: + schedule: + - cron: '0 9 * * 2' + workflow_dispatch: + +name: 'keyvault/add-secret/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export KEYVAULT_NAME=keyvault-$RANDOM + + az keyvault create \ + --resource-group $RESOURCE_GROUP \ + --name $KEYVAULT_NAME + az keyvault secret set \ + --name mySecret \ + --value mySecretValue \ + --vault-name $KEYVAULT_NAME + + export RESULT=$(az keyvault secret show --name mySecret --vault $KEYVAULT_NAME --query value --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != "mySecretValue" ]]; then + echo 'Secret was not properly set' + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/keyvault_create-self-signed-certificate_README_md.yml b/.github/workflows/keyvault_create-self-signed-certificate_README_md.yml new file mode 100644 index 00000000..a1ad6340 --- /dev/null +++ b/.github/workflows/keyvault_create-self-signed-certificate_README_md.yml @@ -0,0 +1,57 @@ +on: + schedule: + - cron: '0 7 * * 2' + workflow_dispatch: + +name: 'keyvault/create-self-signed-certificate/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export KEYVAULT_NAME=keyvault-$RANDOM + + az keyvault create \ + --resource-group $RESOURCE_GROUP \ + --name $KEYVAULT_NAME + export KEYVAULT_CERTIFICATE_ALIAS=self-signed + az keyvault certificate create --vault-name $KEYVAULT_NAME \ + --name $KEYVAULT_CERTIFICATE_ALIAS \ + --policy "$(az keyvault certificate get-default-policy)" + + sleep 60 + export RESULT=$(az keyvault certificate show --vault-name $KEYVAULT_NAME --name $KEYVAULT_CERTIFICATE_ALIAS --output tsv --query attributes.enabled) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != true ]]; then + echo 'Certificate was not provisioned' + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/keyvault_create_README_md.yml b/.github/workflows/keyvault_create_README_md.yml new file mode 100644 index 00000000..b55ba39a --- /dev/null +++ b/.github/workflows/keyvault_create_README_md.yml @@ -0,0 +1,47 @@ +on: + schedule: + - cron: '0 8 * * 2' + workflow_dispatch: + +name: 'keyvault/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export KEYVAULT_NAME=keyvault-$RANDOM + + az keyvault create \ + --resource-group $RESOURCE_GROUP \ + --name $KEYVAULT_NAME + + export RESULT=$(az keyvault show --resource-group $RESOURCE_GROUP --name $KEYVAULT_NAME --output tsv --query properties.provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo 'Key vault was not provisioned' + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/keyvault_spring-boot-mtls-client-side_README_md.yml b/.github/workflows/keyvault_spring-boot-mtls-client-side_README_md.yml new file mode 100644 index 00000000..e7b2ef0e --- /dev/null +++ b/.github/workflows/keyvault_spring-boot-mtls-client-side_README_md.yml @@ -0,0 +1,19 @@ +on: + workflow_dispatch: + +name: 'keyvault/spring-boot-mtls-client-side/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + mvn package +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/keyvault_spring-boot-mtls-server-side_README_md.yml b/.github/workflows/keyvault_spring-boot-mtls-server-side_README_md.yml new file mode 100644 index 00000000..78c18505 --- /dev/null +++ b/.github/workflows/keyvault_spring-boot-mtls-server-side_README_md.yml @@ -0,0 +1,19 @@ +on: + workflow_dispatch: + +name: 'keyvault/spring-boot-mtls-server-side/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + mvn package +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/keyvault_spring-boot-ssl-server-side_README_md.yml b/.github/workflows/keyvault_spring-boot-ssl-server-side_README_md.yml new file mode 100644 index 00000000..8d1fb34d --- /dev/null +++ b/.github/workflows/keyvault_spring-boot-ssl-server-side_README_md.yml @@ -0,0 +1,19 @@ +on: + workflow_dispatch: + +name: 'keyvault/spring-boot-ssl-server-side/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + mvn package +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/kusto_README_md.yml b/.github/workflows/kusto_README_md.yml new file mode 100644 index 00000000..fe7f7aa1 --- /dev/null +++ b/.github/workflows/kusto_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'kusto/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/kusto_create-database_README_md.yml b/.github/workflows/kusto_create-database_README_md.yml new file mode 100644 index 00000000..c989ed16 --- /dev/null +++ b/.github/workflows/kusto_create-database_README_md.yml @@ -0,0 +1,71 @@ +on: + schedule: + - cron: '0 5 * * 2' + workflow_dispatch: + +name: 'kusto/create-database/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add -n kusto + + if [[ -z $ADX_CLUSTER_NAME ]]; then + export ADX_CLUSTER_NAME=adxcluster$RANDOM + az kusto cluster create \ + --cluster-name $ADX_CLUSTER_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku name="Standard_D13_v2" tier="Standard" \ + --location $REGION \ + --type SystemAssigned + fi + + + if [[ -z $ADX_DATABASE_NAME ]]; then + export ADX_DATABASE_NAME=adxdb$RANDOM + az kusto database create \ + --cluster-name $ADX_CLUSTER_NAME \ + --resource-group "$RESOURCE_GROUP" \ + --database-name "$ADX_DATABASE_NAME" \ + --read-write-database location="$REGION" + fi + + + export RESULT=$(az kusto database show --cluster-name $ADX_CLUSTER_NAME \ + --database-name $ADX_DATABASE_NAME --resource-group $RESOURCE_GROUP \ + --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Failed to create ADX database $ADX_DATABASE_NAME" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/kusto_create-table_README_md.yml b/.github/workflows/kusto_create-table_README_md.yml new file mode 100644 index 00000000..7cd1e203 --- /dev/null +++ b/.github/workflows/kusto_create-table_README_md.yml @@ -0,0 +1,61 @@ +on: + workflow_dispatch: + +name: 'kusto/create-table/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add -n kusto + + if [[ -z $ADX_CLUSTER_NAME ]]; then + export ADX_CLUSTER_NAME=adxcluster$RANDOM + az kusto cluster create \ + --cluster-name $ADX_CLUSTER_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku name="Standard_D13_v2" tier="Standard" \ + --location $REGION \ + --type SystemAssigned + fi + + + if [[ -z $ADX_DATABASE_NAME ]]; then + export ADX_DATABASE_NAME=adxdb$RANDOM + az kusto database create \ + --cluster-name $ADX_CLUSTER_NAME \ + --resource-group "$RESOURCE_GROUP" \ + --database-name "$ADX_DATABASE_NAME" \ + --read-write-database location="$REGION" + fi + + export ADX_TABLE=Events +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/kusto_create_README_md.yml b/.github/workflows/kusto_create_README_md.yml new file mode 100644 index 00000000..5fb8147e --- /dev/null +++ b/.github/workflows/kusto_create_README_md.yml @@ -0,0 +1,55 @@ +on: + schedule: + - cron: '0 6 * * 2' + workflow_dispatch: + +name: 'kusto/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add -n kusto + + if [[ -z $ADX_CLUSTER_NAME ]]; then + export ADX_CLUSTER_NAME=adxcluster$RANDOM + az kusto cluster create \ + --cluster-name $ADX_CLUSTER_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku name="Standard_D13_v2" tier="Standard" \ + --location $REGION \ + --type SystemAssigned + fi + + + export RESULT=$(az kusto cluster show --name $ADX_CLUSTER_NAME \ + --resource-group $RESOURCE_GROUP --output tsv --query provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + echo "Failed to create Azure Data Explorer cluster $ADX_CLUSTER_NAME" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/kusto_ingest-client_README_md.yml b/.github/workflows/kusto_ingest-client_README_md.yml new file mode 100644 index 00000000..7e65a229 --- /dev/null +++ b/.github/workflows/kusto_ingest-client_README_md.yml @@ -0,0 +1,61 @@ +on: + workflow_dispatch: + +name: 'kusto/ingest-client/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add -n kusto + + if [[ -z $ADX_CLUSTER_NAME ]]; then + export ADX_CLUSTER_NAME=adxcluster$RANDOM + az kusto cluster create \ + --cluster-name $ADX_CLUSTER_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku name="Standard_D13_v2" tier="Standard" \ + --location $REGION \ + --type SystemAssigned + fi + + + if [[ -z $ADX_DATABASE_NAME ]]; then + export ADX_DATABASE_NAME=adxdb$RANDOM + az kusto database create \ + --cluster-name $ADX_CLUSTER_NAME \ + --resource-group "$RESOURCE_GROUP" \ + --database-name "$ADX_DATABASE_NAME" \ + --read-write-database location="$REGION" + fi + + export ADX_TABLE=Events +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/monitor_README_md.yml b/.github/workflows/monitor_README_md.yml new file mode 100644 index 00000000..4d0c32ba --- /dev/null +++ b/.github/workflows/monitor_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'monitor/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/monitor_create-log-analytics-workspace_README_md.yml b/.github/workflows/monitor_create-log-analytics-workspace_README_md.yml new file mode 100644 index 00000000..1fce81ed --- /dev/null +++ b/.github/workflows/monitor_create-log-analytics-workspace_README_md.yml @@ -0,0 +1,69 @@ +on: + schedule: + - cron: '0 4 * * 2' + workflow_dispatch: + +name: 'monitor/create-log-analytics-workspace/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $MONITOR_LOG_ANALYTICS_WORKSPACE ]]; then + export MONITOR_LOG_ANALYTICS_WORKSPACE=log-analytics-workspace-$RANDOM + az monitor log-analytics workspace create \ + --resource-group $RESOURCE_GROUP \ + --location $REGION \ + --workspace-name $MONITOR_LOG_ANALYTICS_WORKSPACE + fi + + export MONITOR_LOG_ANALYTICS_WORKSPACE_CLIENT_ID=`az monitor log-analytics workspace show \ + --resource-group $RESOURCE_GROUP \ + --workspace-name $MONITOR_LOG_ANALYTICS_WORKSPACE \ + --query customerId \ + --output tsv` + + echo $MONITOR_LOG_ANALYTICS_WORKSPACE_CLIENT_ID + + export MONITOR_LOG_ANALYTICS_WORKSPACE_CLIENT_SECRET=`az monitor log-analytics workspace get-shared-keys \ + --resource-group $RESOURCE_GROUP \ + --workspace-name $MONITOR_LOG_ANALYTICS_WORKSPACE \ + --query primarySharedKey \ + --output tsv` + + echo $MONITOR_LOG_ANALYTICS_WORKSPACE_CLIENT_SECRET + + export RESULT=`az monitor log-analytics workspace show \ + --resource-group $RESOURCE_GROUP \ + --workspace-name $MONITOR_LOG_ANALYTICS_WORKSPACE \ + --query provisioningState \ + --output tsv` + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/mysql_README_md.yml b/.github/workflows/mysql_README_md.yml new file mode 100644 index 00000000..cc2c1610 --- /dev/null +++ b/.github/workflows/mysql_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'mysql/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/mysql_create_README_md.yml b/.github/workflows/mysql_create_README_md.yml new file mode 100644 index 00000000..280e7488 --- /dev/null +++ b/.github/workflows/mysql_create_README_md.yml @@ -0,0 +1,59 @@ +on: + schedule: + - cron: '0 3 * * 2' + workflow_dispatch: + +name: 'mysql/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $MYSQL_NAME ]]; then + export MYSQL_NAME=joaz-mysql-$RANDOM + export MYSQL_USERNAME=mysql + export MYSQL_PASSWORD=p#ssw0rd-$RANDOM + fi + + + az mysql server create \ + --admin-user $MYSQL_USERNAME \ + --admin-password $MYSQL_PASSWORD \ + --name $MYSQL_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku GP_Gen5_2 || true + + sleep 240 + + + export RESULT=$(az mysql server show --name $MYSQL_NAME --resource-group $RESOURCE_GROUP --output tsv --query userVisibleState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Ready ]]; then + echo "Provisioning MySQL " $MYSQL_NAME " failed" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/mysql_get-country_README_md.yml b/.github/workflows/mysql_get-country_README_md.yml new file mode 100644 index 00000000..4f2c62ce --- /dev/null +++ b/.github/workflows/mysql_get-country_README_md.yml @@ -0,0 +1,93 @@ +on: + schedule: + - cron: '0 2 * * 2' + workflow_dispatch: + +name: 'mysql/get-country/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $MYSQL_NAME ]]; then + export MYSQL_NAME=joaz-mysql-$RANDOM + export MYSQL_USERNAME=mysql + export MYSQL_PASSWORD=p#ssw0rd-$RANDOM + fi + + + az mysql server create \ + --admin-user $MYSQL_USERNAME \ + --admin-password $MYSQL_PASSWORD \ + --name $MYSQL_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku GP_Gen5_2 || true + + sleep 240 + + export LOCAL_IP=`curl -s whatismyip.akamai.com` + + az mysql server firewall-rule create \ + --resource-group $RESOURCE_GROUP \ + --server $MYSQL_NAME \ + --name AllowMyLocalIP \ + --start-ip-address $LOCAL_IP \ + --end-ip-address $LOCAL_IP + + cd mysql/load-your-mysql-database-with-data + export MYSQL_DNS_NAME=`az mysql server show \ + --resource-group $RESOURCE_GROUP \ + --name $MYSQL_NAME \ + --query fullyQualifiedDomainName \ + --output tsv` + export MYSQL_CLIENT_USERNAME="$MYSQL_USERNAME@$MYSQL_NAME" + mysql -h $MYSQL_DNS_NAME -u $MYSQL_CLIENT_USERNAME -p$MYSQL_PASSWORD < load.sql + cd ../.. + + + cd mysql/get-country + + mvn package + java -jar target/get-country.jar jdbc:mysql://$MYSQL_DNS_NAME:3306/demo?useSSL=true\&requireSSL=true $MYSQL_CLIENT_USERNAME $MYSQL_PASSWORD USA + + cd ../.. + + + cd mysql/get-country + export RESULT=$(java -jar target/get-country.jar jdbc:mysql://$MYSQL_DNS_NAME:3306/demo?useSSL=true\&requireSSL=true $MYSQL_CLIENT_USERNAME $MYSQL_PASSWORD USA) + cd ../.. + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"United States"* ]]; then + echo "Unable to get the correct country information" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/mysql_load-your-mysql-database-with-data_README_md.yml b/.github/workflows/mysql_load-your-mysql-database-with-data_README_md.yml new file mode 100644 index 00000000..964e78c5 --- /dev/null +++ b/.github/workflows/mysql_load-your-mysql-database-with-data_README_md.yml @@ -0,0 +1,79 @@ +on: + schedule: + - cron: '0 1 * * 2' + workflow_dispatch: + +name: 'mysql/load-your-mysql-database-with-data/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $MYSQL_NAME ]]; then + export MYSQL_NAME=joaz-mysql-$RANDOM + export MYSQL_USERNAME=mysql + export MYSQL_PASSWORD=p#ssw0rd-$RANDOM + fi + + + az mysql server create \ + --admin-user $MYSQL_USERNAME \ + --admin-password $MYSQL_PASSWORD \ + --name $MYSQL_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku GP_Gen5_2 || true + + sleep 240 + + export LOCAL_IP=`curl -s whatismyip.akamai.com` + + az mysql server firewall-rule create \ + --resource-group $RESOURCE_GROUP \ + --server $MYSQL_NAME \ + --name AllowMyLocalIP \ + --start-ip-address $LOCAL_IP \ + --end-ip-address $LOCAL_IP + + cd mysql/load-your-mysql-database-with-data + export MYSQL_DNS_NAME=`az mysql server show \ + --resource-group $RESOURCE_GROUP \ + --name $MYSQL_NAME \ + --query fullyQualifiedDomainName \ + --output tsv` + export MYSQL_CLIENT_USERNAME="$MYSQL_USERNAME@$MYSQL_NAME" + mysql -h $MYSQL_DNS_NAME -u $MYSQL_CLIENT_USERNAME -p$MYSQL_PASSWORD < load.sql + cd ../.. + + + echo 'SELECT COUNT(*) FROM countries;' > check.sql + export RESULT=$(mysql -s -h $MYSQL_DNS_NAME -u $MYSQL_CLIENT_USERNAME -p$MYSQL_PASSWORD demo < check.sql) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != "1" ]]; then + echo "MySQL data was NOT loaded" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/mysql_open-firewall-to-your-ip_README_md.yml b/.github/workflows/mysql_open-firewall-to-your-ip_README_md.yml new file mode 100644 index 00000000..3cea8a60 --- /dev/null +++ b/.github/workflows/mysql_open-firewall-to-your-ip_README_md.yml @@ -0,0 +1,67 @@ +on: + schedule: + - cron: '0 0 * * 2' + workflow_dispatch: + +name: 'mysql/open-firewall-to-your-ip/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $MYSQL_NAME ]]; then + export MYSQL_NAME=joaz-mysql-$RANDOM + export MYSQL_USERNAME=mysql + export MYSQL_PASSWORD=p#ssw0rd-$RANDOM + fi + + + az mysql server create \ + --admin-user $MYSQL_USERNAME \ + --admin-password $MYSQL_PASSWORD \ + --name $MYSQL_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku GP_Gen5_2 || true + + sleep 240 + + export LOCAL_IP=`curl -s whatismyip.akamai.com` + + az mysql server firewall-rule create \ + --resource-group $RESOURCE_GROUP \ + --server $MYSQL_NAME \ + --name AllowMyLocalIP \ + --start-ip-address $LOCAL_IP \ + --end-ip-address $LOCAL_IP + + export RESULT=$(az mysql server firewall-rule show --resource-group $RESOURCE_GROUP --server $MYSQL_NAME --name AllowMyLocalIP --query name --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != AllowMyLocalIP ]]; then + echo "MySQL firewall was NOT configured to allow access from " $LOCAL_IP + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/network_README_md.yml b/.github/workflows/network_README_md.yml new file mode 100644 index 00000000..27d0fc6e --- /dev/null +++ b/.github/workflows/network_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'network/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/network_create-vnet_README_md.yml b/.github/workflows/network_create-vnet_README_md.yml new file mode 100644 index 00000000..7865898b --- /dev/null +++ b/.github/workflows/network_create-vnet_README_md.yml @@ -0,0 +1,41 @@ +on: + schedule: + - cron: '0 23 * * 1' + workflow_dispatch: + +name: 'network/create-vnet/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export VNET=myvnet + az network vnet create \ + --name $VNET \ + --resource-group $RESOURCE_GROUP \ + --subnet-name default + + export RESULT=$(az network vnet show --resource-group $RESOURCE_GROUP --name $VNET --query provisioningState --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/postgres_README_md.yml b/.github/workflows/postgres_README_md.yml new file mode 100644 index 00000000..6e8b8918 --- /dev/null +++ b/.github/workflows/postgres_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'postgres/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/postgres_create_README_md.yml b/.github/workflows/postgres_create_README_md.yml new file mode 100644 index 00000000..4819ad20 --- /dev/null +++ b/.github/workflows/postgres_create_README_md.yml @@ -0,0 +1,50 @@ +on: + schedule: + - cron: '0 22 * * 1' + workflow_dispatch: + +name: 'postgres/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $POSTGRESQL_NAME ]]; then + export POSTGRESQL_NAME=postgresql-$RANDOM + export POSTGRESQL_USERNAME=postgresql + export POSTGRESQL_PASSWORD=p#ssw0rd-$RANDOM + fi + + az postgres server create \ + --admin-user $POSTGRESQL_USERNAME \ + --admin-password $POSTGRESQL_PASSWORD \ + --name $POSTGRESQL_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku GP_Gen5_2 + + export RESULT=$(az postgres server show --resource-group $RESOURCE_GROUP --name $POSTGRESQL_NAME --output tsv --query userVisibleState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Ready ]]; then + echo 'PostgreSQL database is NOT ready' + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/postgres_get-country_README_md.yml b/.github/workflows/postgres_get-country_README_md.yml new file mode 100644 index 00000000..11f9637f --- /dev/null +++ b/.github/workflows/postgres_get-country_README_md.yml @@ -0,0 +1,83 @@ +on: + schedule: + - cron: '0 21 * * 1' + workflow_dispatch: + +name: 'postgres/get-country/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $POSTGRESQL_NAME ]]; then + export POSTGRESQL_NAME=postgresql-$RANDOM + export POSTGRESQL_USERNAME=postgresql + export POSTGRESQL_PASSWORD=p#ssw0rd-$RANDOM + fi + + az postgres server create \ + --admin-user $POSTGRESQL_USERNAME \ + --admin-password $POSTGRESQL_PASSWORD \ + --name $POSTGRESQL_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku GP_Gen5_2 + export LOCAL_IP=`curl -s whatismyip.akamai.com` + + az postgres server firewall-rule create \ + --resource-group $RESOURCE_GROUP \ + --server-name $POSTGRESQL_NAME \ + --name AllowMyLocalIP \ + --start-ip-address $LOCAL_IP \ + --end-ip-address $LOCAL_IP + + cd postgres/load-your-postgresql-database-with-data + + export POSTGRESQL_DNS_NAME=`az postgres server show \ + --resource-group $RESOURCE_GROUP \ + --name $POSTGRESQL_NAME \ + --query fullyQualifiedDomainName \ + --output tsv` + + export POSTGRESQL_CLIENT_USERNAME="$POSTGRESQL_USERNAME@$POSTGRESQL_NAME" + + PGPASSWORD=$POSTGRESQL_PASSWORD psql --host=$POSTGRESQL_DNS_NAME --port=5432 --username $POSTGRESQL_CLIENT_USERNAME --dbname=postgres --file load.sql + + cd ../.. + + + cd postgres/get-country + + mvn package + java -jar target/get-country.jar jdbc:postgresql://$POSTGRESQL_DNS_NAME:5432/demo?ssl=true\&sslmode=require $POSTGRESQL_CLIENT_USERNAME $POSTGRESQL_PASSWORD USA + + cd ../.. + + + cd postgres/get-country + export RESULT=$(java -jar target/get-country.jar jdbc:postgresql://$POSTGRESQL_DNS_NAME:5432/demo?ssl=true\&sslmode=require $POSTGRESQL_CLIENT_USERNAME $POSTGRESQL_PASSWORD USA) + cd ../.. + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"United States"* ]]; then + echo "Unable to get the correct country information" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/postgres_load-your-postgresql-database-with-data_README_md.yml b/.github/workflows/postgres_load-your-postgresql-database-with-data_README_md.yml new file mode 100644 index 00000000..63665fce --- /dev/null +++ b/.github/workflows/postgres_load-your-postgresql-database-with-data_README_md.yml @@ -0,0 +1,74 @@ +on: + schedule: + - cron: '0 20 * * 1' + workflow_dispatch: + +name: 'postgres/load-your-postgresql-database-with-data/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $POSTGRESQL_NAME ]]; then + export POSTGRESQL_NAME=postgresql-$RANDOM + export POSTGRESQL_USERNAME=postgresql + export POSTGRESQL_PASSWORD=p#ssw0rd-$RANDOM + fi + + az postgres server create \ + --admin-user $POSTGRESQL_USERNAME \ + --admin-password $POSTGRESQL_PASSWORD \ + --name $POSTGRESQL_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku GP_Gen5_2 + export LOCAL_IP=`curl -s whatismyip.akamai.com` + + az postgres server firewall-rule create \ + --resource-group $RESOURCE_GROUP \ + --server-name $POSTGRESQL_NAME \ + --name AllowMyLocalIP \ + --start-ip-address $LOCAL_IP \ + --end-ip-address $LOCAL_IP + + cd postgres/load-your-postgresql-database-with-data + + export POSTGRESQL_DNS_NAME=`az postgres server show \ + --resource-group $RESOURCE_GROUP \ + --name $POSTGRESQL_NAME \ + --query fullyQualifiedDomainName \ + --output tsv` + + export POSTGRESQL_CLIENT_USERNAME="$POSTGRESQL_USERNAME@$POSTGRESQL_NAME" + + PGPASSWORD=$POSTGRESQL_PASSWORD psql --host=$POSTGRESQL_DNS_NAME --port=5432 --username $POSTGRESQL_CLIENT_USERNAME --dbname=postgres --file load.sql + + cd ../.. + + + echo 'SELECT COUNT(*) FROM countries;' > check.sql + export RESULT=$(PGPASSWORD=$POSTGRESQL_PASSWORD psql --host=$POSTGRESQL_DNS_NAME -qtAX --port=5432 --username $POSTGRESQL_CLIENT_USERNAME --dbname=demo --csv < check.sql) + if [[ "$RESULT" != "1" ]]; then + echo "PostgreSQL data was NOT loaded" + exit 1 + fi + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/postgres_open-firewall-to-your-ip_README_md.yml b/.github/workflows/postgres_open-firewall-to-your-ip_README_md.yml new file mode 100644 index 00000000..ff1de067 --- /dev/null +++ b/.github/workflows/postgres_open-firewall-to-your-ip_README_md.yml @@ -0,0 +1,58 @@ +on: + schedule: + - cron: '0 19 * * 1' + workflow_dispatch: + +name: 'postgres/open-firewall-to-your-ip/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + + if [[ -z $POSTGRESQL_NAME ]]; then + export POSTGRESQL_NAME=postgresql-$RANDOM + export POSTGRESQL_USERNAME=postgresql + export POSTGRESQL_PASSWORD=p#ssw0rd-$RANDOM + fi + + az postgres server create \ + --admin-user $POSTGRESQL_USERNAME \ + --admin-password $POSTGRESQL_PASSWORD \ + --name $POSTGRESQL_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku GP_Gen5_2 + export LOCAL_IP=`curl -s whatismyip.akamai.com` + + az postgres server firewall-rule create \ + --resource-group $RESOURCE_GROUP \ + --server-name $POSTGRESQL_NAME \ + --name AllowMyLocalIP \ + --start-ip-address $LOCAL_IP \ + --end-ip-address $LOCAL_IP + + export RESULT=$(az postgres server firewall-rule show --resource-group $RESOURCE_GROUP --server-name $POSTGRESQL_NAME --name AllowMyLocalIP --query name --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != AllowMyLocalIP ]]; then + echo "PostgreSQL firewall was NOT configured to allow access from " $LOCAL_IP + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/redis_README_md.yml b/.github/workflows/redis_README_md.yml new file mode 100644 index 00000000..4853e4b2 --- /dev/null +++ b/.github/workflows/redis_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'redis/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/redis_create_README_md.yml b/.github/workflows/redis_create_README_md.yml new file mode 100644 index 00000000..e6a5c706 --- /dev/null +++ b/.github/workflows/redis_create_README_md.yml @@ -0,0 +1,44 @@ +on: + schedule: + - cron: '0 18 * * 1' + workflow_dispatch: + +name: 'redis/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export REDIS_NAME=joaz-redis-$RANDOM + + az redis create \ + --location $REGION \ + --name $REDIS_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --vm-size c0 + + export RESULT=$(az redis show --resource-group $RESOURCE_GROUP --name $REDIS_NAME --query provisioningState --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/redis_lettuce_README_md.yml b/.github/workflows/redis_lettuce_README_md.yml new file mode 100644 index 00000000..faeca818 --- /dev/null +++ b/.github/workflows/redis_lettuce_README_md.yml @@ -0,0 +1,55 @@ +on: + schedule: + - cron: '0 17 * * 1' + workflow_dispatch: + +name: 'redis/lettuce/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export REDIS_NAME=joaz-redis-$RANDOM + + az redis create \ + --location $REGION \ + --name $REDIS_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Basic \ + --vm-size c0 + + cd redis/lettuce + + mvn clean package + export REDIS_HOST=$(az redis show --resource-group $RESOURCE_GROUP --name $REDIS_NAME --query hostName --output tsv) + export REDIS_PASSWORD=$(az redis list-keys --resource-group $RESOURCE_GROUP --name $REDIS_NAME --query primaryKey --output tsv) + java -jar target/redis-lettuce.jar --host $REDIS_HOST --password $REDIS_PASSWORD --command set --key key --value value + java -jar target/redis-lettuce.jar --host $REDIS_HOST --password $REDIS_PASSWORD --command get --key key + + export RESULT=$(java -jar target/redis-lettuce.jar --host $REDIS_HOST --password $REDIS_PASSWORD --command get --key key) + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != value ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/redis_springboot_README_md.yml b/.github/workflows/redis_springboot_README_md.yml new file mode 100644 index 00000000..4ea1f891 --- /dev/null +++ b/.github/workflows/redis_springboot_README_md.yml @@ -0,0 +1,18 @@ +on: + workflow_dispatch: + +name: 'redis/springboot/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/servicebus_README_md.yml b/.github/workflows/servicebus_README_md.yml new file mode 100644 index 00000000..ae80ff04 --- /dev/null +++ b/.github/workflows/servicebus_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'servicebus/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/servicebus_create-queue_README_md.yml b/.github/workflows/servicebus_create-queue_README_md.yml new file mode 100644 index 00000000..67d1197d --- /dev/null +++ b/.github/workflows/servicebus_create-queue_README_md.yml @@ -0,0 +1,49 @@ +on: + schedule: + - cron: '0 15 * * 1' + workflow_dispatch: + +name: 'servicebus/create-queue/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export SERVICE_BUS=joaz-sb-$RANDOM + az servicebus namespace create \ + --resource-group $RESOURCE_GROUP \ + --name $SERVICE_BUS \ + --sku Premium \ + --location $REGION + if [[ -z $SERVICE_BUS_QUEUE ]]; then + export SERVICE_BUS_QUEUE=service-bus-queue-$RANDOM + fi + az servicebus queue create \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $SERVICE_BUS \ + --name $SERVICE_BUS_QUEUE + + export RESULT=$(az servicebus queue show --resource-group $RESOURCE_GROUP --namespace $SERVICE_BUS --name $SERVICE_BUS_QUEUE --query status --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Active ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/servicebus_create_README_md.yml b/.github/workflows/servicebus_create_README_md.yml new file mode 100644 index 00000000..933cf0bb --- /dev/null +++ b/.github/workflows/servicebus_create_README_md.yml @@ -0,0 +1,42 @@ +on: + schedule: + - cron: '0 16 * * 1' + workflow_dispatch: + +name: 'servicebus/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export SERVICE_BUS=joaz-sb-$RANDOM + az servicebus namespace create \ + --resource-group $RESOURCE_GROUP \ + --name $SERVICE_BUS \ + --sku Premium \ + --location $REGION + + export RESULT=$(az servicebus namespace show --resource-group $RESOURCE_GROUP --name $SERVICE_BUS --query provisioningState --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/servicebus_receive-jms-message_README_md.yml b/.github/workflows/servicebus_receive-jms-message_README_md.yml new file mode 100644 index 00000000..682b9115 --- /dev/null +++ b/.github/workflows/servicebus_receive-jms-message_README_md.yml @@ -0,0 +1,75 @@ +on: + schedule: + - cron: '0 14 * * 1' + workflow_dispatch: + +name: 'servicebus/receive-jms-message/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export SERVICE_BUS=joaz-sb-$RANDOM + az servicebus namespace create \ + --resource-group $RESOURCE_GROUP \ + --name $SERVICE_BUS \ + --sku Premium \ + --location $REGION + if [[ -z $SERVICE_BUS_QUEUE ]]; then + export SERVICE_BUS_QUEUE=service-bus-queue-$RANDOM + fi + az servicebus queue create \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $SERVICE_BUS \ + --name $SERVICE_BUS_QUEUE + export SERVICE_BUS_QUEUE_CONNECTION_STRING=$(az servicebus namespace authorization-rule keys list \ + --resource-group $RESOURCE_GROUP --namespace-name $SERVICE_BUS --name RootManageSharedAccessKey \ + --query primaryConnectionString --output tsv) + + cd servicebus/send-jms-message + + mvn clean package + java -jar target/send-jms-message.jar + + cd ../.. + + export SERVICE_BUS_QUEUE_CONNECTION_STRING=$(az servicebus namespace authorization-rule keys list \ + --resource-group $RESOURCE_GROUP --namespace-name $SERVICE_BUS --name RootManageSharedAccessKey \ + --query primaryConnectionString --output tsv) + + cd servicebus/receive-jms-message + + mvn clean package + java -jar target/receive-jms-message.jar + + cd ../.. + + + export RESULT=$(az servicebus queue show --resource-group $RESOURCE_GROUP --namespace $SERVICE_BUS --name $SERVICE_BUS_QUEUE --query countDetails.activeMessageCount --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != "0" ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/servicebus_receive-message_README_md.yml b/.github/workflows/servicebus_receive-message_README_md.yml new file mode 100644 index 00000000..7267caf3 --- /dev/null +++ b/.github/workflows/servicebus_receive-message_README_md.yml @@ -0,0 +1,71 @@ +on: + schedule: + - cron: '0 13 * * 1' + workflow_dispatch: + +name: 'servicebus/receive-message/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export SERVICE_BUS=joaz-sb-$RANDOM + az servicebus namespace create \ + --resource-group $RESOURCE_GROUP \ + --name $SERVICE_BUS \ + --sku Premium \ + --location $REGION + if [[ -z $SERVICE_BUS_QUEUE ]]; then + export SERVICE_BUS_QUEUE=service-bus-queue-$RANDOM + fi + az servicebus queue create \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $SERVICE_BUS \ + --name $SERVICE_BUS_QUEUE + export SERVICE_BUS_QUEUE_CONNECTION_STRING=$(az servicebus namespace authorization-rule keys list \ + --resource-group $RESOURCE_GROUP --namespace-name $SERVICE_BUS --name RootManageSharedAccessKey \ + --query primaryConnectionString --output tsv) + + cd servicebus/send-message + + mvn clean package + java -jar target/send-message.jar + + cd ../.. + + export SERVICE_BUS_QUEUE_CONNECTION_STRING=$(az servicebus namespace authorization-rule keys list \ + --resource-group $RESOURCE_GROUP --namespace-name $SERVICE_BUS --name RootManageSharedAccessKey \ + --query primaryConnectionString --output tsv) + + cd servicebus/receive-message + + mvn clean package + java -jar target/receive-message.jar + + cd ../.. + + + export RESULT=$(az servicebus queue show --resource-group $RESOURCE_GROUP --namespace $SERVICE_BUS --name $SERVICE_BUS_QUEUE --query countDetails.activeMessageCount --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != "0" ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/servicebus_send-jms-message_README_md.yml b/.github/workflows/servicebus_send-jms-message_README_md.yml new file mode 100644 index 00000000..664855d1 --- /dev/null +++ b/.github/workflows/servicebus_send-jms-message_README_md.yml @@ -0,0 +1,64 @@ +on: + schedule: + - cron: '0 12 * * 1' + workflow_dispatch: + +name: 'servicebus/send-jms-message/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/setup-java@v4' + with: + java-version: '17' + distribution: 'temurin' + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export SERVICE_BUS=joaz-sb-$RANDOM + az servicebus namespace create \ + --resource-group $RESOURCE_GROUP \ + --name $SERVICE_BUS \ + --sku Premium \ + --location $REGION + if [[ -z $SERVICE_BUS_QUEUE ]]; then + export SERVICE_BUS_QUEUE=service-bus-queue-$RANDOM + fi + az servicebus queue create \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $SERVICE_BUS \ + --name $SERVICE_BUS_QUEUE + export SERVICE_BUS_QUEUE_CONNECTION_STRING=$(az servicebus namespace authorization-rule keys list \ + --resource-group $RESOURCE_GROUP --namespace-name $SERVICE_BUS --name RootManageSharedAccessKey \ + --query primaryConnectionString --output tsv) + + cd servicebus/send-jms-message + + mvn clean package + java -jar target/send-jms-message.jar + + cd ../.. + + + export RESULT=$(az servicebus queue show --resource-group $RESOURCE_GROUP --namespace $SERVICE_BUS --name $SERVICE_BUS_QUEUE --query countDetails.activeMessageCount --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != 1 ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/servicebus_send-message_README_md.yml b/.github/workflows/servicebus_send-message_README_md.yml new file mode 100644 index 00000000..f0e2a93b --- /dev/null +++ b/.github/workflows/servicebus_send-message_README_md.yml @@ -0,0 +1,60 @@ +on: + schedule: + - cron: '0 11 * * 1' + workflow_dispatch: + +name: 'servicebus/send-message/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export SERVICE_BUS=joaz-sb-$RANDOM + az servicebus namespace create \ + --resource-group $RESOURCE_GROUP \ + --name $SERVICE_BUS \ + --sku Premium \ + --location $REGION + if [[ -z $SERVICE_BUS_QUEUE ]]; then + export SERVICE_BUS_QUEUE=service-bus-queue-$RANDOM + fi + az servicebus queue create \ + --resource-group $RESOURCE_GROUP \ + --namespace-name $SERVICE_BUS \ + --name $SERVICE_BUS_QUEUE + export SERVICE_BUS_QUEUE_CONNECTION_STRING=$(az servicebus namespace authorization-rule keys list \ + --resource-group $RESOURCE_GROUP --namespace-name $SERVICE_BUS --name RootManageSharedAccessKey \ + --query primaryConnectionString --output tsv) + + cd servicebus/send-message + + mvn clean package + java -jar target/send-message.jar + + cd ../.. + + + export RESULT=$(az servicebus queue show --resource-group $RESOURCE_GROUP --namespace $SERVICE_BUS --name $SERVICE_BUS_QUEUE --query countDetails.activeMessageCount --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != 1 ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/spring_README_md.yml b/.github/workflows/spring_README_md.yml new file mode 100644 index 00000000..57d5e7bf --- /dev/null +++ b/.github/workflows/spring_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'spring/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/spring_config-server_README_md.yml b/.github/workflows/spring_config-server_README_md.yml new file mode 100644 index 00000000..5ece5d48 --- /dev/null +++ b/.github/workflows/spring_config-server_README_md.yml @@ -0,0 +1,49 @@ +on: + schedule: + - cron: '0 10 * * 1' + workflow_dispatch: + +name: 'spring/config-server/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add --name spring + + export SPRING_NAME=spring-$RANDOM + + az spring create \ + --resource-group $RESOURCE_GROUP \ + --name $SPRING_NAME + + cd spring/config-server + + az spring config-server set \ + --config-file application.yml \ + --name ${SPRING_NAME} \ + --resource-group ${RESOURCE_GROUP} + + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/spring_create_README_md.yml b/.github/workflows/spring_create_README_md.yml new file mode 100644 index 00000000..e20928e0 --- /dev/null +++ b/.github/workflows/spring_create_README_md.yml @@ -0,0 +1,43 @@ +on: + schedule: + - cron: '0 9 * * 1' + workflow_dispatch: + +name: 'spring/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add --name spring + + export SPRING_NAME=spring-$RANDOM + + az spring create \ + --resource-group $RESOURCE_GROUP \ + --name $SPRING_NAME + + export RESULT=$(az spring show --resource-group $RESOURCE_GROUP --name $SPRING_NAME --output tsv --query properties.provisioningState) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/spring_helloworld_README_md.yml b/.github/workflows/spring_helloworld_README_md.yml new file mode 100644 index 00000000..d370de28 --- /dev/null +++ b/.github/workflows/spring_helloworld_README_md.yml @@ -0,0 +1,75 @@ +on: + schedule: + - cron: '0 8 * * 1' + workflow_dispatch: + +name: 'spring/helloworld/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + az extension add --name spring + + export SPRING_NAME=spring-$RANDOM + + az spring create \ + --resource-group $RESOURCE_GROUP \ + --name $SPRING_NAME + + cd spring/helloworld + + mvn package + az spring app create \ + --name helloworld \ + --service ${SPRING_NAME} \ + --resource-group ${RESOURCE_GROUP} \ + --assign-endpoint \ + --runtime-version Java_11 \ + --verbose + + az spring app deploy \ + --name helloworld \ + --service ${SPRING_NAME} \ + --resource-group ${RESOURCE_GROUP} \ + --artifact-path ./target/spring-helloworld.jar \ + --verbose + + az spring app show \ + --name helloworld \ + --service ${SPRING_NAME} \ + --resource-group ${RESOURCE_GROUP} \ + --query properties.url \ + --output tsv + + export URL=$(az spring app show \ + --name helloworld \ + --service ${SPRING_NAME} \ + --resource-group ${RESOURCE_GROUP} \ + --query properties.url \ + --output tsv) + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Hello World"* ]]; then + echo "Response did not contain 'Hello World'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/spring_spring-cloud-config-server_README_md.yml b/.github/workflows/spring_spring-cloud-config-server_README_md.yml new file mode 100644 index 00000000..8f73743a --- /dev/null +++ b/.github/workflows/spring_spring-cloud-config-server_README_md.yml @@ -0,0 +1,18 @@ +on: + workflow_dispatch: + +name: 'spring/spring-cloud-config-server/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/sql_README_md.yml b/.github/workflows/sql_README_md.yml new file mode 100644 index 00000000..5e007baf --- /dev/null +++ b/.github/workflows/sql_README_md.yml @@ -0,0 +1,20 @@ +on: + workflow_dispatch: + +name: 'sql/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + exit 0 +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/sql_create_README_md.yml b/.github/workflows/sql_create_README_md.yml new file mode 100644 index 00000000..44ee2686 --- /dev/null +++ b/.github/workflows/sql_create_README_md.yml @@ -0,0 +1,47 @@ +on: + schedule: + - cron: '0 7 * * 1' + workflow_dispatch: + +name: 'sql/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $MSSQL_NAME ]]; then + export MSSQL_NAME=mssql-$RANDOM + export MSSQL_USERNAME=mssql + export MSSQL_PASSWORD=p#ssw0rd-$RANDOM + fi + az sql server create \ + --admin-user $MSSQL_USERNAME \ + --admin-password $MSSQL_PASSWORD \ + --name $MSSQL_NAME \ + --resource-group $RESOURCE_GROUP + + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/sql_deploy-springboot-sql_README_md.yml b/.github/workflows/sql_deploy-springboot-sql_README_md.yml new file mode 100644 index 00000000..599ad0ca --- /dev/null +++ b/.github/workflows/sql_deploy-springboot-sql_README_md.yml @@ -0,0 +1,18 @@ +on: + workflow_dispatch: + +name: 'sql/deploy-springboot-sql/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/sql_get-country_README_md.yml b/.github/workflows/sql_get-country_README_md.yml new file mode 100644 index 00000000..fb264e59 --- /dev/null +++ b/.github/workflows/sql_get-country_README_md.yml @@ -0,0 +1,79 @@ +on: + schedule: + - cron: '0 6 * * 1' + workflow_dispatch: + +name: 'sql/get-country/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $MSSQL_NAME ]]; then + export MSSQL_NAME=mssql-$RANDOM + export MSSQL_USERNAME=mssql + export MSSQL_PASSWORD=p#ssw0rd-$RANDOM + fi + az sql server create \ + --admin-user $MSSQL_USERNAME \ + --admin-password $MSSQL_PASSWORD \ + --name $MSSQL_NAME \ + --resource-group $RESOURCE_GROUP + export LOCAL_IP=`curl -s whatismyip.akamai.com` + + az sql server firewall-rule create \ + --resource-group $RESOURCE_GROUP \ + --server $MSSQL_NAME \ + --name AllowMyLocalIP \ + --start-ip-address $LOCAL_IP \ + --end-ip-address $LOCAL_IP + + cd sql/load-your-mssql-database-with-data + sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 + python -m pip install --upgrade pip + sudo pip install mssql-cli + sudo pip install cli-helpers --upgrade --force + export MSSQL_DNS_NAME=`az sql server show \ + --resource-group $RESOURCE_GROUP \ + --name $MSSQL_NAME \ + --query fullyQualifiedDomainName \ + --output tsv` + export MSSQL_CLIENT_USERNAME="$MSSQL_USERNAME@$MSSQL_NAME" + mssql-cli -S $MSSQL_DNS_NAME -U $MSSQL_CLIENT_USERNAME -P $MSSQL_PASSWORD -i create.sql + mssql-cli -S $MSSQL_DNS_NAME -U $MSSQL_CLIENT_USERNAME -P $MSSQL_PASSWORD -d demo -i load.sql + cd ../.. + + + cd sql/get-country + + mvn package + java -jar target/get-country.jar "jdbc:sqlserver://$MSSQL_DNS_NAME:1433;databaseName=demo;encrypt=true;trustServerCertificate=true" $MSSQL_CLIENT_USERNAME $MSSQL_PASSWORD USA + + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/sql_load-your-mssql-database-with-data_README_md.yml b/.github/workflows/sql_load-your-mssql-database-with-data_README_md.yml new file mode 100644 index 00000000..abed0f01 --- /dev/null +++ b/.github/workflows/sql_load-your-mssql-database-with-data_README_md.yml @@ -0,0 +1,71 @@ +on: + schedule: + - cron: '0 5 * * 1' + workflow_dispatch: + +name: 'sql/load-your-mssql-database-with-data/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $MSSQL_NAME ]]; then + export MSSQL_NAME=mssql-$RANDOM + export MSSQL_USERNAME=mssql + export MSSQL_PASSWORD=p#ssw0rd-$RANDOM + fi + az sql server create \ + --admin-user $MSSQL_USERNAME \ + --admin-password $MSSQL_PASSWORD \ + --name $MSSQL_NAME \ + --resource-group $RESOURCE_GROUP + export LOCAL_IP=`curl -s whatismyip.akamai.com` + + az sql server firewall-rule create \ + --resource-group $RESOURCE_GROUP \ + --server $MSSQL_NAME \ + --name AllowMyLocalIP \ + --start-ip-address $LOCAL_IP \ + --end-ip-address $LOCAL_IP + + cd sql/load-your-mssql-database-with-data + sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 + python -m pip install --upgrade pip + sudo pip install mssql-cli + sudo pip install cli-helpers --upgrade --force + export MSSQL_DNS_NAME=`az sql server show \ + --resource-group $RESOURCE_GROUP \ + --name $MSSQL_NAME \ + --query fullyQualifiedDomainName \ + --output tsv` + export MSSQL_CLIENT_USERNAME="$MSSQL_USERNAME@$MSSQL_NAME" + mssql-cli -S $MSSQL_DNS_NAME -U $MSSQL_CLIENT_USERNAME -P $MSSQL_PASSWORD -i create.sql + mssql-cli -S $MSSQL_DNS_NAME -U $MSSQL_CLIENT_USERNAME -P $MSSQL_PASSWORD -d demo -i load.sql + cd ../.. + + + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/sql_open-firewall-to-your-ip_README_md.yml b/.github/workflows/sql_open-firewall-to-your-ip_README_md.yml new file mode 100644 index 00000000..7dc4e08e --- /dev/null +++ b/.github/workflows/sql_open-firewall-to-your-ip_README_md.yml @@ -0,0 +1,53 @@ +on: + schedule: + - cron: '0 4 * * 1' + workflow_dispatch: + +name: 'sql/open-firewall-to-your-ip/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + + if [[ -z $REGION ]]; then + export REGION=westus3 + fi + + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + if [[ -z $MSSQL_NAME ]]; then + export MSSQL_NAME=mssql-$RANDOM + export MSSQL_USERNAME=mssql + export MSSQL_PASSWORD=p#ssw0rd-$RANDOM + fi + az sql server create \ + --admin-user $MSSQL_USERNAME \ + --admin-password $MSSQL_PASSWORD \ + --name $MSSQL_NAME \ + --resource-group $RESOURCE_GROUP + export LOCAL_IP=`curl -s whatismyip.akamai.com` + + az sql server firewall-rule create \ + --resource-group $RESOURCE_GROUP \ + --server $MSSQL_NAME \ + --name AllowMyLocalIP \ + --start-ip-address $LOCAL_IP \ + --end-ip-address $LOCAL_IP +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/storage_create_README_md.yml b/.github/workflows/storage_create_README_md.yml new file mode 100644 index 00000000..24272275 --- /dev/null +++ b/.github/workflows/storage_create_README_md.yml @@ -0,0 +1,45 @@ +on: + schedule: + - cron: '0 3 * * 1' + workflow_dispatch: + +name: 'storage/create/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export STORAGE_ACCOUNT_NAME=joazst$RANDOM + + az storage account create \ + --name $STORAGE_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Standard_LRS \ + --kind StorageV2 + + export STORAGE_ACCOUNT_CONNECTION_STRING=$(az storage account show-connection-string --resource-group $RESOURCE_GROUP --name $STORAGE_ACCOUNT_NAME --output tsv) + + export RESULT=$(az storage account show --resource-group $RESOURCE_GROUP --name $STORAGE_ACCOUNT_NAME --query provisioningState --output tsv) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != Succeeded ]]; then + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/storage_enable-static-website_README_md.yml b/.github/workflows/storage_enable-static-website_README_md.yml new file mode 100644 index 00000000..73c75a72 --- /dev/null +++ b/.github/workflows/storage_enable-static-website_README_md.yml @@ -0,0 +1,53 @@ +on: + schedule: + - cron: '0 2 * * 1' + workflow_dispatch: + +name: 'storage/enable-static-website/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export STORAGE_ACCOUNT_NAME=joazst$RANDOM + + az storage account create \ + --name $STORAGE_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Standard_LRS \ + --kind StorageV2 + + export STORAGE_ACCOUNT_CONNECTION_STRING=$(az storage account show-connection-string --resource-group $RESOURCE_GROUP --name $STORAGE_ACCOUNT_NAME --output tsv) + az storage blob service-properties update \ + --account-name $STORAGE_ACCOUNT_NAME \ + --connection-string $STORAGE_ACCOUNT_CONNECTION_STRING \ + --static-website \ + --404-document 404.html \ + --index-document index.html + + az storage account show \ + --name $STORAGE_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --query primaryEndpoints.web \ + --output tsv + + az group delete --name $RESOURCE_GROUP --yes || true +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file diff --git a/.github/workflows/storage_upload-files-to-static-website_README_md.yml b/.github/workflows/storage_upload-files-to-static-website_README_md.yml new file mode 100644 index 00000000..3cc27547 --- /dev/null +++ b/.github/workflows/storage_upload-files-to-static-website_README_md.yml @@ -0,0 +1,71 @@ +on: + schedule: + - cron: '0 1 * * 1' + workflow_dispatch: + +name: 'storage/upload-files-to-static-website/README.md' +jobs: + validate: + runs-on: 'ubuntu-latest' + steps: + - uses: 'azure/login@v1' + with: + subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' + client-id: '${{ secrets.AZURE_CLIENT_ID }}' + tenant-id: '${{ secrets.AZURE_TENANT_ID }}' + - uses: 'actions/checkout@v3' + - run: | + if [[ -z $REGION ]]; then + export REGION=westus + fi + + if [[ -z $RESOURCE_GROUP ]]; then + export RESOURCE_GROUP=joazrg-$RANDOM + echo "Using '"$RESOURCE_GROUP"' as resource group" + fi + + az group create --name $RESOURCE_GROUP --location $REGION + export STORAGE_ACCOUNT_NAME=joazst$RANDOM + + az storage account create \ + --name $STORAGE_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --sku Standard_LRS \ + --kind StorageV2 + + export STORAGE_ACCOUNT_CONNECTION_STRING=$(az storage account show-connection-string --resource-group $RESOURCE_GROUP --name $STORAGE_ACCOUNT_NAME --output tsv) + az storage blob service-properties update \ + --account-name $STORAGE_ACCOUNT_NAME \ + --connection-string $STORAGE_ACCOUNT_CONNECTION_STRING \ + --static-website \ + --404-document 404.html \ + --index-document index.html + + az storage account show \ + --name $STORAGE_ACCOUNT_NAME \ + --resource-group $RESOURCE_GROUP \ + --query primaryEndpoints.web \ + --output tsv + + cd storage/upload-files-to-static-website + + az storage blob upload-batch \ + --source web \ + --destination '$web' \ + --account-name $STORAGE_ACCOUNT_NAME \ + --connection-string $STORAGE_ACCOUNT_CONNECTION_STRING + + sleep 60 + cd ../.. + + + export URL=$(az storage account show --name $STORAGE_ACCOUNT_NAME --query primaryEndpoints.web --output tsv)index.html + export RESULT=$(curl $URL) + az group delete --name $RESOURCE_GROUP --yes || true + if [[ "$RESULT" != *"Azure Storage"* ]]; then + echo "Response did not contain 'This is served from Azure Storage'" + exit 1 + fi +permissions: + contents: 'read' + id-token: 'write' \ No newline at end of file