public void OryxArgumentShouldBeAppService()
        {
            IEnvironment   ienv = new TestMockedIEnvironment();
            IOryxArguments args = OryxArgumentsFactory.CreateOryxArguments(ienv);

            Assert.IsType <AppServiceOryxArguments>(args);
        }
예제 #2
0
 public void OryxArgumentShouldBeFunctionApp()
 {
     using (new TestScopedEnvironmentVariable("FUNCTIONS_WORKER_RUNTIME", "PYTHON"))
         using (new TestScopedEnvironmentVariable("FUNCTIONS_EXTENSION_VERSION", "~2"))
         {
             IOryxArguments args = OryxArgumentsFactory.CreateOryxArguments();
             Assert.IsType <FunctionAppOryxArguments>(args);
         }
 }
예제 #3
0
 public void OryxArgumentShouldBeLinuxConsumption()
 {
     using (new TestScopedEnvironmentVariable("FUNCTIONS_WORKER_RUNTIME", "PYTHON"))
         using (new TestScopedEnvironmentVariable("FUNCTIONS_EXTENSION_VERSION", "~2"))
             using (new TestScopedEnvironmentVariable("SCM_RUN_FROM_PACKAGE", "http://microsoft.com"))
             {
                 IOryxArguments args = OryxArgumentsFactory.CreateOryxArguments();
                 Assert.IsType <LinuxConsumptionFunctionAppOryxArguments>(args);
             }
 }
예제 #4
0
        public override Task Build(DeploymentContext context)
        {
            FileLogHelper.Log("In oryx build...");

            // initialize the repository Path for the build
            context.RepositoryPath = RepositoryPath;

            context.Logger.Log("Repository path is " + context.RepositoryPath);

            // Initialize Oryx Args.
            IOryxArguments args = OryxArgumentsFactory.CreateOryxArguments(environment);

            if (!args.SkipKuduSync)
            {
                // Step 1: Run kudusync
                string kuduSyncCommand = string.Format("kudusync -v 50 -f {0} -t {1} -n {2} -p {3} -i \".git;.hg;.deployment;.deploy.sh\"",
                                                       context.RepositoryPath,
                                                       context.OutputPath,
                                                       context.NextManifestFilePath,
                                                       context.PreviousManifestFilePath
                                                       );

                FileLogHelper.Log("Running KuduSync with  " + kuduSyncCommand);

                RunCommand(context, kuduSyncCommand, false, "Oryx-Build: Running kudu sync...");
            }

            if (args.RunOryxBuild)
            {
                PreOryxBuild(context);

                string buildCommand = args.GenerateOryxBuildCommand(context);
                RunCommand(context, buildCommand, false, "Running oryx build...");

                //
                // Run express build setups if needed
                if (args.Flags == BuildOptimizationsFlags.UseExpressBuild)
                {
                    if (FunctionAppHelper.LooksLikeFunctionApp())
                    {
                        SetupFunctionAppExpressArtifacts(context);
                    }
                    else
                    {
                        ExpressBuilder appServiceExpressBuilder = new ExpressBuilder(environment, settings, propertyProvider, sourcePath);
                        appServiceExpressBuilder.SetupExpressBuilderArtifacts(context.OutputPath, context, args);
                    }
                }
                else if (args.Flags == BuildOptimizationsFlags.DeploymentV2)
                {
                    SetupAppServiceArtifacts(context);
                }
            }
            return(Task.CompletedTask);
        }
예제 #5
0
        public override Task Build(DeploymentContext context)
        {
            FileLogHelper.Log("In oryx build...");

            // initialize the repository Path for the build
            context.RepositoryPath = RepositoryPath;

            // Initialize Oryx Args.
            IOryxArguments args = OryxArgumentsFactory.CreateOryxArguments();

            if (!args.SkipKuduSync)
            {
                // Step 1: Run kudusync
                string kuduSyncCommand = string.Format("kudusync -v 50 -f {0} -t {1} -n {2} -p {3} -i \".git;.hg;.deployment;.deploy.sh\"",
                                                       RepositoryPath,
                                                       context.OutputPath,
                                                       context.NextManifestFilePath,
                                                       context.PreviousManifestFilePath
                                                       );

                FileLogHelper.Log("Running KuduSync with  " + kuduSyncCommand);

                RunCommand(context, kuduSyncCommand, false, "Oryx-Build: Running kudu sync...");
            }

            if (args.RunOryxBuild)
            {
                PreOryxBuild(context);

                string buildCommand = args.GenerateOryxBuildCommand(context);
                RunCommand(context, buildCommand, false, "Running oryx build...");

                //
                // Run express build setups if needed
                if (args.Flags == BuildOptimizationsFlags.UseExpressBuild)
                {
                    if (FunctionAppHelper.LooksLikeFunctionApp())
                    {
                        SetupFunctionAppExpressArtifacts(context);
                    }
                    else
                    {
                        Oryx.ExpressBuilder.SetupExpressBuilderArtifacts(context.OutputPath);
                    }
                }
            }

            // Detect if package upload is necessary for server side build
            if (FunctionAppHelper.HasScmRunFromPackage() && FunctionAppHelper.LooksLikeFunctionApp())
            {
                SetupLinuxConsumptionFunctionAppDeployment(context).Wait();
            }

            return(Task.CompletedTask);
        }
예제 #6
0
        public void BuildCommandForAppService()
        {
            DeploymentContext deploymentContext = new DeploymentContext()
            {
                OutputPath = "outputpath"
            };
            IOryxArguments args    = OryxArgumentsFactory.CreateOryxArguments();
            string         command = args.GenerateOryxBuildCommand(deploymentContext);

            Assert.Equal(@"oryx build outputpath -o outputpath", command);
        }
예제 #7
0
        public void OryxArgumentSkipKuduSync(bool expectedSkipKuduSync, params string[] varargs)
        {
            IDictionary <string, string> env = new Dictionary <string, string>();

            for (int i = 0; i < varargs.Length; i += 2)
            {
                env.Add(varargs[i], varargs[i + 1]);
            }

            using (new TestScopedEnvironmentVariable(env))
            {
                IOryxArguments args = OryxArgumentsFactory.CreateOryxArguments();
                Assert.Equal(expectedSkipKuduSync, args.SkipKuduSync);
            }
        }
예제 #8
0
        public void BuildCommandForLinuxConsumptionFunctionApp()
        {
            DeploymentContext deploymentContext = new DeploymentContext()
            {
                RepositoryPath = "repositorypath"
            };

            using (new TestScopedEnvironmentVariable("FUNCTIONS_EXTENSION_VERSION", "~2"))
                using (new TestScopedEnvironmentVariable("SCM_RUN_FROM_PACKAGE", "http://microsoft.com"))
                {
                    IOryxArguments args    = OryxArgumentsFactory.CreateOryxArguments();
                    string         command = args.GenerateOryxBuildCommand(deploymentContext);
                    Assert.Equal(@"oryx build repositorypath -o repositorypath", command);
                }
        }
예제 #9
0
        public void BuildCommandForFunctionApp()
        {
            DeploymentContext deploymentContext = new DeploymentContext()
            {
                OutputPath    = "outputpath",
                BuildTempPath = "buildtemppath"
            };

            using (new TestScopedEnvironmentVariable("FUNCTIONS_EXTENSION_VERSION", "~2"))
            {
                IOryxArguments args    = OryxArgumentsFactory.CreateOryxArguments();
                string         command = args.GenerateOryxBuildCommand(deploymentContext);
                Assert.Equal(@"oryx build outputpath -o outputpath -i buildtemppath", command);
            }
        }
예제 #10
0
        public void BuildCommandForPythonFunctionApp()
        {
            DeploymentContext deploymentContext = new DeploymentContext()
            {
                OutputPath    = "outputpath",
                BuildTempPath = "buildtemppath"
            };

            using (new TestScopedEnvironmentVariable("FUNCTIONS_EXTENSION_VERSION", "~2"))
                using (new TestScopedEnvironmentVariable("FUNCTIONS_WORKER_RUNTIME", "python"))
                {
                    IOryxArguments args    = OryxArgumentsFactory.CreateOryxArguments();
                    string         command = args.GenerateOryxBuildCommand(deploymentContext);
                    Assert.Equal(@"oryx build outputpath -o outputpath --platform python --platform-version 3.6 -i buildtemppath -p packagedir=.python_packages\lib\python3.6\site-packages", command);
                }
        }
        public void OryxArgumentRunOryxBuild(bool expectedRunOryxBuild, params string[] varargs)
        {
            IDictionary <string, string> env = new Dictionary <string, string>();

            for (int i = 0; i < varargs.Length; i += 2)
            {
                env.Add(varargs[i], varargs[i + 1]);
            }

            using (new TestScopedEnvironmentVariable(env))
            {
                IEnvironment   ienv = TestMockedEnvironment.GetMockedEnvironment();
                IOryxArguments args = OryxArgumentsFactory.CreateOryxArguments(ienv);
                Assert.Equal(expectedRunOryxBuild, args.RunOryxBuild);
            }
        }
예제 #12
0
        public void OryxArgumentShouldBeAppService()
        {
            IOryxArguments args = OryxArgumentsFactory.CreateOryxArguments();

            Assert.IsType <AppServiceOryxArguments>(args);
        }