Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Invoking AzureResourceFilterUtility.getAppDetails with slotname (master) #429

Merged
merged 3 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/pr_check_webapp_dotnet_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- master
- 'releases/*'

permissions:
id-token: write

# CONFIGURATION
# For help, go to https://github.com/Azure/Actions
#
Expand Down Expand Up @@ -75,9 +78,11 @@ jobs:
}

- name: Azure authentication
uses: azure/login@v1
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_WEBAPP_SPN }}
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: 'Deploy to Azure WebApp'
uses: ./webapps-deploy/
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/pr_check_windows_container_pubprofile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- master
- 'releases/*'

permissions:
id-token: write

env:
AZURE_WEBAPP_NAME: wincontainerswebapp # set this to your application's name
CONTAINER_REGISTRY: webdeployprtestscontainerregistry.azurecr.io # set secret with Container Registry URL, example : xyz.azurecr.io
Expand All @@ -31,9 +34,11 @@ jobs:
path: 'python_container_App'

- name: Azure authentication
uses: azure/login@v1
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_WEBAPP_SPN }}
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Logout from Azure Container Registry
run: |
Expand Down
19 changes: 9 additions & 10 deletions lib/ActionInputValidator/Validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validatePackageInput = exports.validateContainerInputs = exports.validateSingleContainerInputs = exports.multiContainerNotAllowed = exports.packageNotAllowed = exports.startupCommandNotAllowed = exports.validateAppDetails = exports.containerInputsNotAllowed = exports.appNameIsRequired = void 0;
exports.appNameIsRequired = appNameIsRequired;
exports.containerInputsNotAllowed = containerInputsNotAllowed;
exports.validateAppDetails = validateAppDetails;
exports.startupCommandNotAllowed = startupCommandNotAllowed;
exports.packageNotAllowed = packageNotAllowed;
exports.multiContainerNotAllowed = multiContainerNotAllowed;
exports.validateSingleContainerInputs = validateSingleContainerInputs;
exports.validateContainerInputs = validateContainerInputs;
exports.validatePackageInput = validatePackageInput;
const core = __importStar(require("@actions/core"));
const packageUtility_1 = require("azure-actions-utility/packageUtility");
const PublishProfile_1 = require("../Utilities/PublishProfile");
Expand All @@ -44,14 +52,12 @@ function appNameIsRequired(appname) {
throw new Error("app-name is a required input.");
}
}
exports.appNameIsRequired = appNameIsRequired;
// Error if image info is provided
function containerInputsNotAllowed(images, configFile, isPublishProfile = false) {
if (!!images || !!configFile) {
throw new Error(`This is not a container web app. Please remove inputs like images and configuration-file which are only relevant for container deployment.`);
}
}
exports.containerInputsNotAllowed = containerInputsNotAllowed;
// Cross-validate provided app name and slot is same as that in publish profile
function validateAppDetails() {
let actionParams = actionparameters_1.ActionParameters.getActionParams();
Expand All @@ -66,36 +72,31 @@ function validateAppDetails() {
}
}
}
exports.validateAppDetails = validateAppDetails;
// Error is startup command is provided
function startupCommandNotAllowed(startupCommand) {
if (!!startupCommand) {
throw new Error("startup-command is not a valid input for Windows web app or with publish-profile auth scheme.");
}
}
exports.startupCommandNotAllowed = startupCommandNotAllowed;
// Error if package input is provided
function packageNotAllowed(apppackage) {
if (!!apppackage && apppackage !== '.') {
throw new Error("package is not a valid input for container web app.");
}
}
exports.packageNotAllowed = packageNotAllowed;
// Error if multi container config file is provided
function multiContainerNotAllowed(configFile) {
if (!!configFile) {
throw new Error("Multi container support is not available for windows containerized web app or with publish profile.");
}
}
exports.multiContainerNotAllowed = multiContainerNotAllowed;
// Error if image name is not provided
function validateSingleContainerInputs() {
const actionParams = actionparameters_1.ActionParameters.getActionParams();
if (!actionParams.images) {
throw new Error("Image name not provided for container. Provide a valid image name");
}
}
exports.validateSingleContainerInputs = validateSingleContainerInputs;
// Validate container inputs
function validateContainerInputs() {
let actionParams = actionparameters_1.ActionParameters.getActionParams();
Expand Down Expand Up @@ -123,7 +124,6 @@ function validateContainerInputs() {
throw new Error("Multiple images indicate multi-container deployment type, but Docker-compose file is absent.");
}
}
exports.validateContainerInputs = validateContainerInputs;
// validate package input
function validatePackageInput() {
return __awaiter(this, void 0, void 0, function* () {
Expand All @@ -136,4 +136,3 @@ function validatePackageInput() {
}
});
}
exports.validatePackageInput = validatePackageInput;
2 changes: 1 addition & 1 deletion lib/ActionInputValidator/ValidatorFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ValidatorFactory {
}
static getResourceDetails(params) {
return __awaiter(this, void 0, void 0, function* () {
let appDetails = yield AzureResourceFilterUtility_1.AzureResourceFilterUtility.getAppDetails(params.endpoint, params.appName, params.resourceGroupName);
let appDetails = yield AzureResourceFilterUtility_1.AzureResourceFilterUtility.getAppDetails(params.endpoint, params.appName, params.resourceGroupName, params.slotName);
params.resourceGroupName = appDetails["resourceGroupName"];
params.realKind = appDetails["kind"];
params.kind = actionparameters_1.appKindMap.get(params.realKind);
Expand Down
3 changes: 1 addition & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.main = void 0;
exports.main = main;
const core = __importStar(require("@actions/core"));
const crypto = __importStar(require("crypto"));
const actionparameters_1 = require("./actionparameters");
Expand Down Expand Up @@ -90,5 +90,4 @@ function main() {
}
});
}
exports.main = main;
main();
Loading
Loading