예제 #1
0
        public async Task FrontendBackendBuildTest()
        {
            await DockerAssert.DeleteDockerImagesAsync(output, "test/backend");

            await DockerAssert.DeleteDockerImagesAsync(output, "test/frontend");

            var projectName = "frontend-backend";
            var environment = "production";

            var projectDirectory = new DirectoryInfo(Path.Combine(TestHelpers.GetSolutionRootDirectory("tye"), "samples", projectName));

            using var tempDirectory = TempDirectory.Create();
            DirectoryCopy.Copy(projectDirectory.FullName, tempDirectory.DirectoryPath);

            var projectFile = new FileInfo(Path.Combine(tempDirectory.DirectoryPath, "tye.yaml"));

            var application = ConfigFactory.FromFile(projectFile);

            application.Registry = "test";

            try
            {
                await BuildHost.ExecuteBuildAsync(new OutputContext(sink, Verbosity.Debug), application, environment, interactive : false);

                await DockerAssert.AssertImageExistsAsync(output, "test/backend");

                await DockerAssert.AssertImageExistsAsync(output, "test/frontend");
            }
            finally
            {
                await DockerAssert.DeleteDockerImagesAsync(output, "test/backend");

                await DockerAssert.DeleteDockerImagesAsync(output, "test/frontend");
            }
        }
예제 #2
0
        public async Task TyeBuild_SinglePhase_ExistingDockerfileWithBuildArgs()
        {
            var projectName = "single-phase-dockerfile-args";
            var environment = "production";
            var imageName   = "test/web";

            await DockerAssert.DeleteDockerImagesAsync(output, imageName);

            using var projectDirectory = CopyTestProjectDirectory(projectName);
            Assert.True(File.Exists(Path.Combine(projectDirectory.DirectoryPath, "Dockerfile")), "Dockerfile should exist.");

            var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));

            var outputContext = new OutputContext(sink, Verbosity.Debug);
            var application   = await ApplicationFactory.CreateAsync(outputContext, projectFile);

            application.Registry = new ContainerRegistry("test");

            try
            {
                await BuildHost.ExecuteBuildAsync(outputContext, application, environment, interactive : false);

                Assert.Single(application.Services.Single().Outputs.OfType <DockerImageOutput>());
                var builder   = (DockerFileServiceBuilder)application.Services.First();
                var valuePair = builder.BuildArgs.First();
                Assert.Equal("pat", valuePair.Key);
                Assert.Equal("thisisapat", valuePair.Value);

                await DockerAssert.AssertImageExistsAsync(output, imageName);
            }
            finally
            {
                await DockerAssert.DeleteDockerImagesAsync(output, imageName);
            }
        }
예제 #3
0
        public async Task GenerateWorksWithoutRegistry()
        {
            await DockerAssert.DeleteDockerImagesAsync(output, "test-project");

            var projectName = "single-project";
            var environment = "production";

            var projectDirectory = new DirectoryInfo(Path.Combine(TestHelpers.GetSolutionRootDirectory("tye"), "samples", projectName));

            using var tempDirectory = TempDirectory.Create();
            DirectoryCopy.Copy(projectDirectory.FullName, tempDirectory.DirectoryPath);

            var projectFile = new FileInfo(Path.Combine(tempDirectory.DirectoryPath, "tye.yaml"));

            var application = ConfigFactory.FromFile(projectFile);

            try
            {
                await GenerateHost.ExecuteGenerateAsync(new OutputContext(sink, Verbosity.Debug), application, environment, interactive : false);

                // name of application is the folder
                var content         = File.ReadAllText(Path.Combine(tempDirectory.DirectoryPath, $"{projectName}-generate-{environment}.yaml"));
                var expectedContent = File.ReadAllText($"testassets/generate/{projectName}-noregistry.yaml");

                Assert.Equal(expectedContent, content);

                await BuildHost.ExecuteBuildAsync(new OutputContext(sink, Verbosity.Debug), application, environment, interactive : false);

                await DockerAssert.AssertImageExistsAsync(output, "test-project");
            }
            finally
            {
                await DockerAssert.DeleteDockerImagesAsync(output, "test-project");
            }
        }
예제 #4
0
        public async Task TyeBuild_SinglePhase_ExistingDockerfile()
        {
            var projectName = "single-phase-dockerfile";
            var environment = "production";
            var imageName   = "test/single-phase-dockerfile";

            await DockerAssert.DeleteDockerImagesAsync(output, imageName);

            using var projectDirectory = CopyTestProjectDirectory(projectName);
            Assert.True(File.Exists(Path.Combine(projectDirectory.DirectoryPath, "Dockerfile")), "Dockerfile should exist.");


            var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));

            var outputContext = new OutputContext(sink, Verbosity.Debug);
            var application   = await ApplicationFactory.CreateAsync(outputContext, projectFile);

            application.Registry = new ContainerRegistry("test");

            try
            {
                await BuildHost.ExecuteBuildAsync(outputContext, application, environment, interactive : false);

                var publishOutput = Assert.Single(application.Services.Single().Outputs.OfType <ProjectPublishOutput>());
                Assert.False(Directory.Exists(publishOutput.Directory.FullName), $"Directory {publishOutput.Directory.FullName} should be deleted.");

                await DockerAssert.AssertImageExistsAsync(output, imageName);
            }
            finally
            {
                await DockerAssert.DeleteDockerImagesAsync(output, imageName);
            }
        }
예제 #5
0
        public async Task FrontendBackendBuildTest()
        {
            await DockerAssert.DeleteDockerImagesAsync(output, "test/backend");

            await DockerAssert.DeleteDockerImagesAsync(output, "test/frontend");

            var projectName = "frontend-backend";
            var environment = "production";

            using var projectDirectory = CopyTestProjectDirectory(projectName);

            var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));

            var outputContext = new OutputContext(sink, Verbosity.Debug);
            var application   = await ApplicationFactory.CreateAsync(outputContext, projectFile);

            application.Registry = new ContainerRegistry("test");

            try
            {
                await BuildHost.ExecuteBuildAsync(outputContext, application, environment, interactive : false);

                await DockerAssert.AssertImageExistsAsync(output, "test/backend");

                await DockerAssert.AssertImageExistsAsync(output, "test/frontend");
            }
            finally
            {
                await DockerAssert.DeleteDockerImagesAsync(output, "test/backend");

                await DockerAssert.DeleteDockerImagesAsync(output, "test/frontend");
            }
        }
예제 #6
0
        public async Task BuildDoesNotRequireRegistry()
        {
            await DockerAssert.DeleteDockerImagesAsync(output, "test-project");

            var projectName = "single-project";
            var environment = "production";

            var projectDirectory = new DirectoryInfo(Path.Combine(TestHelpers.GetSolutionRootDirectory("tye"), "samples", projectName));

            using var tempDirectory = TempDirectory.Create();
            DirectoryCopy.Copy(projectDirectory.FullName, tempDirectory.DirectoryPath);

            var projectFile   = new FileInfo(Path.Combine(tempDirectory.DirectoryPath, "tye.yaml"));
            var outputContext = new OutputContext(sink, Verbosity.Debug);
            var application   = await ApplicationFactory.CreateAsync(outputContext, projectFile);

            try
            {
                await BuildHost.ExecuteBuildAsync(outputContext, application, environment, interactive : false);

                await DockerAssert.AssertImageExistsAsync(output, "test-project");
            }
            finally
            {
                await DockerAssert.DeleteDockerImagesAsync(output, "test-project");
            }
        }
예제 #7
0
        public async Task TyeBuild_MultipleTargetFrameworks_YamlBuildProperties()
        {
            var projectName = "multi-targetframeworks";
            var environment = "production";
            var imageName   = "test/multi-targetframeworks";

            await DockerAssert.DeleteDockerImagesAsync(output, imageName);

            using var projectDirectory = CopyTestProjectDirectory(projectName);

            var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye-with-netcoreapp31.yaml"));

            var outputContext = new OutputContext(sink, Verbosity.Debug);
            var application   = await ApplicationFactory.CreateAsync(outputContext, projectFile, "netcoreapp3.1");

            application.Registry = new ContainerRegistry("test");

            try
            {
                await BuildHost.ExecuteBuildAsync(outputContext, application, environment, interactive : false);

                var publishOutput = Assert.Single(application.Services.Single().Outputs.OfType <ProjectPublishOutput>());
                Assert.False(Directory.Exists(publishOutput.Directory.FullName), $"Directory {publishOutput.Directory.FullName} should be deleted.");

                await DockerAssert.AssertImageExistsAsync(output, imageName);
            }
            finally
            {
                await DockerAssert.DeleteDockerImagesAsync(output, imageName);
            }
        }
        /// <summary>
        /// Create a host and initialize the environment.
        /// </summary>
        /// <param name="builder"></param>
        public void Init(EnvironmentBuilder builder)
        {
            builder.Create();

            // create the main build host
            BuildHost.CreateHost(builder.Get <HostEnvironment>());
        }
예제 #9
0
        protected BaseContentPage()
        {
            Host = BuildHost.Create(this, (buildEnvironment, layoutContext) =>
            {
                var statefulContainer = CreateStateContainer(buildEnvironment);

                _statefulContainer = statefulContainer;

                Init(buildEnvironment);

                return(statefulContainer);
            });


            // now start the host
            Host.Start();
        }
예제 #10
0
        /// <summary>
        /// Create the environment to allow for Model View Update to operate for this activity.
        /// </summary>
        /// <param name="savedInstanceState"></param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            _host = BuildHost.Create(this, (buildEnvironment, layoutContext) =>
            {
                var statefulContainer = CreateStateContainer(buildEnvironment);

                Init(buildEnvironment);

                return(statefulContainer);
            });


            // now start the host
            _host.Start();
        }
예제 #11
0
        public override void LoadSettingsFromStorage()
        {
            var versions = new List <QtVersionsTable.Row>();

            foreach (var versionName in VersionManager.GetVersions())
            {
                var       versionPath = VersionManager.GetInstallPath(versionName);
                BuildHost host        = BuildHost.Windows;
                string    compiler    = "msvc";
                if (versionPath.StartsWith("SSH:") || versionPath.StartsWith("WSL:"))
                {
                    var linuxPaths = versionPath.Split(':');
                    versionPath = linuxPaths[1];
                    if (linuxPaths[0] == "SSH")
                    {
                        host = BuildHost.LinuxSSH;
                    }
                    else
                    {
                        host = BuildHost.LinuxWSL;
                    }
                    compiler = "g++";
                    if (linuxPaths.Length > 2 && !string.IsNullOrEmpty(linuxPaths[2]))
                    {
                        compiler = linuxPaths[2];
                    }
                }
                var defaultVersion = VersionManager.GetDefaultVersion();
                versions.Add(new QtVersionsTable.Row()
                {
                    IsDefault   = (versionName == defaultVersion),
                    VersionName = versionName,
                    Path        = versionPath,
                    Host        = host,
                    Compiler    = compiler,
                });
            }
            VersionsTable.UpdateVersions(versions);
        }
예제 #12
0
        public async Task BuildDoesNotRequireRegistry()
        {
            await DockerAssert.DeleteDockerImagesAsync(output, "test-project");

            var projectName = "single-project";
            var environment = "production";

            using var projectDirectory = CopySampleProjectDirectory(projectName);

            var projectFile   = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
            var outputContext = new OutputContext(sink, Verbosity.Debug);
            var application   = await ApplicationFactory.CreateAsync(outputContext, projectFile);

            try
            {
                await BuildHost.ExecuteBuildAsync(outputContext, application, environment, interactive : false);

                await DockerAssert.AssertImageExistsAsync(output, "test-project");
            }
            finally
            {
                await DockerAssert.DeleteDockerImagesAsync(output, "test-project");
            }
        }
 public HitTestResult(BuildHost host, CPUCore core, BuildEvent ev)
 {
     _host = host;
     _core = core;
     _event = ev;
 }
예제 #14
0
 public override void Apply(HostEnvironment settings)
 {
     BuildHost.CreateHost(settings);
 }
예제 #15
0
 void InitBuildHost()
 {
     if(m_buildHost == null)
     {
         m_buildHost = new BuildHost();
     }
 }
예제 #16
0
        public string[] GetDependencies(bool fIncludeStartProgram, bool fPE, bool fTargetIsBigEndian)
        {
            string frameworkVersion = GetTargetFrameworkProperty();

            if (m_buildHost == null)
            {
                m_buildHost = new BuildHost();
            }

            if (!m_buildHost.HasBeenBuilt)
            {
                bool fSuccess;
                int err;
                Version ver = new Version(frameworkVersion.TrimStart('v'));

                err = m_innerIVsProjectBuildSystem.SetHostObject(
                        ((ver.Major == 4 && ver.Minor >= 1) || ver.Major > 4) ? fTargetIsBigEndian ? BuildHost.c_RESOLVE_RUNTIME_DEPENDENCIES_TARGETBE : BuildHost.c_RESOLVE_RUNTIME_DEPENDENCIES_TARGETLE : BuildHost.c_RESOLVE_RUNTIME_DEPENDENCIES_TARGET,
                        BuildHost.c_RESOLVE_RUNTIME_DEPENDENCIES_TASK,
                        m_buildHost);
                err = m_innerIVsProjectBuildSystem.BuildTarget(BuildHost.c_RESOLVE_REFERENCES_TARGET, out fSuccess);
            }

            return m_buildHost.GetDependencies(fIncludeStartProgram, fPE, fTargetIsBigEndian, frameworkVersion);
        }
예제 #17
0
 private int SetTargetFrameworkProperty(uint targetFxVerUint)
 {
     try
     {
         string s = "v" + Utility.VersionFromUint(targetFxVerUint).ToString(2);
         m_buildHost = new BuildHost();
         return this.SetTargetFrameworkProperty(s);
     }
     catch (Exception ex)
     {
         VsPackage.MessageCentre.InternalErrorMsg(false, String.Format("Error while setting target framework property to int \"{0:X}\" (Exception was: \"{1}\").", targetFxVerUint, ex.Message));
         return Utility.COM_HResults.E_FAIL;
     }
 }
            //......................
            public CPUCore(BuildHost parent, int coreIndex)
            {
                _parent = parent;

                _coreIndex = coreIndex;

                _textBlock.Text = string.Format("{0} (Core # {1})", parent._name, _coreIndex);

                _StaticWindow.CoresCanvas.Children.Add(_textBlock);

                _StaticWindow.EventsCanvas.Children.Add(this);


                this.Height = pix_height;

                if (_sLODImage == null)
                {

                    _sLODImage = new Image();
                    _sLODImage.Source = GetBitmapImage(FASTBuildMonitorVSIX.Resources.Images.LODBlock);
                }

                this.ToolTip = _toolTip;
            }
        private void ExecuteCommandStartJob(string[] tokens, Int64 eventLocalTimeMS)
        {
            Int64 timeStamp = (eventLocalTimeMS - _buildStartTimeMS);

            string hostName = tokens[CommandArgumentIndex.START_JOB_HOST_NAME];
            string eventName = tokens[CommandArgumentIndex.START_JOB_EVENT_NAME];

            if (_bPreparingBuildsteps)
            {
                _localHost.OnCompleteEvent(timeStamp, _cPrepareBuildStepsText, BuildEventState.SUCCEEDED_COMPLETED, "");
            }

            BuildEvent newEvent = new BuildEvent(eventName, timeStamp);

            BuildHost host = null;
            if (_hosts.ContainsKey(hostName))
            {
                host = _hosts[hostName] as BuildHost;
            }
            else
            {
                // discovered a new host!
                host = new BuildHost(hostName);
                _hosts.Add(hostName, host);
            }

            host.OnStartEvent(newEvent);
        }
        private void ResetState()
        {
            _fileStreamPosition = 0;
            _fileStream.Seek(0, SeekOrigin.Begin);

            _fileBuffer.Clear();

            _buildRunningState = eBuildRunningState.Ready;
            _buildStatus = eBuildStatus.AllClear;

            _buildStartTimeMS = 0;
            _latestTimeStampMS = 0;

            _hosts.Clear();
            _localHost = null;

            _lastProcessedPosition = 0;
            _bPreparingBuildsteps = false;

            _StaticWindow.EventsCanvas.Children.Clear();
            _StaticWindow.CoresCanvas.Children.Clear();

            // Start by adding a local host
            _localHost = new BuildHost(_cLocalHostName);
            _hosts.Add(_cLocalHostName, _localHost);

            // Always add the prepare build steps event first
            BuildEvent buildEvent = new BuildEvent(_cPrepareBuildStepsText, 0);
            _localHost.OnStartEvent(buildEvent);
            _bPreparingBuildsteps = true;

            // Reset the Output window text
            OutputTextBox.Text = "";

            // Change back the tabcontrol to the TimeLine automatically
            _StaticWindow.MyTabControl.SelectedIndex = (int)eTABs.TAB_TimeLine;

            ResetOutputWindowCombox();

            // progress status
            UpdateBuildProgress(0.0f);
            StatusBarProgressBar.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF06B025"));

            // reset to autoscrolling ON
            _autoScrolling = true;

            // reset our zoom levels
            _zoomFactor = 1.0f;
            _zoomFactorOld = 0.1f;

            // target pid
            _targetPID = 0;
            _lastTargetPIDCheckTimeMS = 0;

            // live build session state
            _isLiveSession = false;

            // graphs
            SystemGraphsCanvas.Children.Clear();
            _systemPerformanceGraphs = new SystemPerformanceGraphsCanvas(SystemGraphsCanvas);

            // allow a free render update on the first frame after the reset
            SetConditionalRenderUpdateFlag(true);

            // reset the cached SteppedBuildTime value
            _sPreviousSteppedBuildTimeMS = 0;
        }