Search in sources :

Example 1 with ApplicationVersion

use of com.yahoo.vespa.hosted.controller.application.ApplicationVersion in project vespa by vespa-engine.

the class DeploymentTriggerTest method dualChangesAreNotSkippedWhenOnePartIsDeployedAlready.

@Test
public void dualChangesAreNotSkippedWhenOnePartIsDeployedAlready() {
    DeploymentTester tester = new DeploymentTester();
    Application application = tester.createApplication("app1", "tenant1", 1, 1L);
    Supplier<Application> app = () -> tester.application(application.id());
    ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("us-central-1").region("eu-west-1").build();
    tester.deployCompletely(application, applicationPackage);
    // Platform upgrade which doesn't succeed, allowing a dual change.
    Version version1 = new Version("7.1");
    tester.upgradeSystem(version1);
    tester.completeUpgradeWithError(application, version1, applicationPackage, productionEuWest1);
    // Deploy the new application version, even though the platform version is already deployed in us-central-1.
    // Let it fail in us-central-1 after deployment, so we can test this zone is later skipped.
    tester.jobCompletion(component).application(application).nextBuildNumber().uploadArtifact(applicationPackage).submit();
    tester.deployAndNotify(application, applicationPackage, true, false, systemTest);
    tester.deployAndNotify(application, applicationPackage, true, false, stagingTest);
    tester.jobCompletion(productionEuWest1).application(application).unsuccessful().submit();
    tester.deploy(productionUsCentral1, application, Optional.empty(), false);
    // Deploying before notifying here makes the job not re-trigger, but instead triggers the next job (because of triggerReadyJobs() in notification.)
    tester.deployAndNotify(application, applicationPackage, false, productionUsCentral1);
    assertEquals(ApplicationVersion.from(BuildJob.defaultSourceRevision, BuildJob.defaultBuildNumber + 1), app.get().deployments().get(ZoneId.from("prod.us-central-1")).applicationVersion());
    assertEquals(Collections.singletonList(new BuildService.BuildJob(1, productionEuWest1.jobName())), tester.deploymentQueue().jobs());
    tester.deploy(productionEuWest1, application, Optional.empty(), false);
    tester.deployAndNotify(application, Optional.empty(), false, true, productionEuWest1);
    assertFalse(app.get().change().isPresent());
    assertTrue(tester.deploymentQueue().jobs().isEmpty());
}
Also used : Version(com.yahoo.component.Version) ApplicationVersion(com.yahoo.vespa.hosted.controller.application.ApplicationVersion) Application(com.yahoo.vespa.hosted.controller.Application) LockedApplication(com.yahoo.vespa.hosted.controller.LockedApplication) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) JobType.systemTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest) Test(org.junit.Test) JobType.stagingTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)

Example 2 with ApplicationVersion

use of com.yahoo.vespa.hosted.controller.application.ApplicationVersion in project vespa by vespa-engine.

the class ControllerTest method runDeployment.

private void runDeployment(DeploymentTester tester, ApplicationId application, ApplicationVersion version, ApplicationPackage applicationPackage, SourceRevision sourceRevision, long buildNumber) {
    Application app = tester.applications().require(application);
    tester.jobCompletion(component).application(app).buildNumber(buildNumber).sourceRevision(sourceRevision).uploadArtifact(applicationPackage).submit();
    ApplicationVersion change = ApplicationVersion.from(sourceRevision, buildNumber);
    assertEquals(change.id(), tester.controller().applications().require(application).change().application().get().id());
    runDeployment(tester, app, version, Optional.empty(), Optional.of(applicationPackage));
}
Also used : ApplicationVersion(com.yahoo.vespa.hosted.controller.application.ApplicationVersion)

Example 3 with ApplicationVersion

use of com.yahoo.vespa.hosted.controller.application.ApplicationVersion in project vespa by vespa-engine.

the class ControllerTest method runUpgrade.

private void runUpgrade(DeploymentTester tester, ApplicationId application, ApplicationVersion version) {
    Version next = Version.fromString("6.2");
    tester.upgradeSystem(next);
    runDeployment(tester, tester.applications().require(application), version, Optional.of(next), Optional.empty());
}
Also used : ApplicationVersion(com.yahoo.vespa.hosted.controller.application.ApplicationVersion) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) Version(com.yahoo.component.Version)

Example 4 with ApplicationVersion

use of com.yahoo.vespa.hosted.controller.application.ApplicationVersion in project vespa by vespa-engine.

the class ControllerTest method runDeployment.

private void runDeployment(DeploymentTester tester, Application app, ApplicationVersion version, Optional<Version> upgrade, Optional<ApplicationPackage> applicationPackage) {
    Version vespaVersion = upgrade.orElseGet(tester::defaultVespaVersion);
    // Deploy in test
    tester.deployAndNotify(app, applicationPackage, true, true, systemTest);
    tester.deployAndNotify(app, applicationPackage, true, true, stagingTest);
    assertStatus(JobStatus.initial(stagingTest).withTriggering(vespaVersion, version, "", tester.clock().instant().minus(Duration.ofMillis(1))).withCompletion(42, Optional.empty(), tester.clock().instant(), tester.controller()), app.id(), tester.controller());
    // Deploy in production
    tester.deployAndNotify(app, applicationPackage, true, true, productionCorpUsEast1);
    assertStatus(JobStatus.initial(productionCorpUsEast1).withTriggering(vespaVersion, version, "", tester.clock().instant().minus(Duration.ofMillis(1))).withCompletion(42, Optional.empty(), tester.clock().instant(), tester.controller()), app.id(), tester.controller());
    tester.deployAndNotify(app, applicationPackage, true, true, productionUsEast3);
    assertStatus(JobStatus.initial(productionUsEast3).withTriggering(vespaVersion, version, "", tester.clock().instant().minus(Duration.ofMillis(1))).withCompletion(42, Optional.empty(), tester.clock().instant(), tester.controller()), app.id(), tester.controller());
    // Verify deployed version
    app = tester.controller().applications().require(app.id());
    for (Deployment deployment : app.productionDeployments().values()) {
        assertEquals(version, deployment.applicationVersion());
        upgrade.ifPresent(v -> assertEquals(v, deployment.version()));
    }
}
Also used : ApplicationVersion(com.yahoo.vespa.hosted.controller.application.ApplicationVersion) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) Version(com.yahoo.component.Version) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment)

Example 5 with ApplicationVersion

use of com.yahoo.vespa.hosted.controller.application.ApplicationVersion in project vespa by vespa-engine.

the class ControllerTest method testDeploymentApplicationVersion.

@Test
public void testDeploymentApplicationVersion() {
    DeploymentTester tester = new DeploymentTester();
    Application app = tester.createApplication("app1", "tenant1", 1, 11L);
    ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("corp-us-east-1").region("us-east-3").build();
    SourceRevision source = new SourceRevision("repo", "master", "commit1");
    ApplicationVersion applicationVersion = ApplicationVersion.from(source, 101);
    runDeployment(tester, app.id(), applicationVersion, applicationPackage, source, 101);
    assertEquals("Artifact is downloaded twice in staging and once for other zones", 5, tester.artifactRepository().hits(app.id(), applicationVersion.id()));
    // Application is upgraded. This makes deployment orchestration pick the last successful application version in
    // zones which do not have permanent deployments, e.g. test and staging
    runUpgrade(tester, app.id(), applicationVersion);
}
Also used : SourceRevision(com.yahoo.vespa.hosted.controller.application.SourceRevision) ApplicationVersion(com.yahoo.vespa.hosted.controller.application.ApplicationVersion) DeploymentTester(com.yahoo.vespa.hosted.controller.deployment.DeploymentTester) ApplicationPackageBuilder(com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) JobType.stagingTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest) JobType.systemTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest) Test(org.junit.Test)

Aggregations

ApplicationVersion (com.yahoo.vespa.hosted.controller.application.ApplicationVersion)11 Version (com.yahoo.component.Version)6 ApplicationPackage (com.yahoo.vespa.hosted.controller.application.ApplicationPackage)6 Test (org.junit.Test)5 JobType.stagingTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)4 JobType.systemTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest)4 Application (com.yahoo.vespa.hosted.controller.Application)3 Deployment (com.yahoo.vespa.hosted.controller.application.Deployment)3 Pair (com.yahoo.collections.Pair)2 DeploymentSpec (com.yahoo.config.application.api.DeploymentSpec)2 LockedApplication (com.yahoo.vespa.hosted.controller.LockedApplication)2 TenantId (com.yahoo.vespa.hosted.controller.api.identifiers.TenantId)2 DeploymentJobs (com.yahoo.vespa.hosted.controller.application.DeploymentJobs)2 JobStatus (com.yahoo.vespa.hosted.controller.application.JobStatus)2 VespaVersion (com.yahoo.vespa.hosted.controller.versions.VespaVersion)2 ArrayList (java.util.ArrayList)2 ImmutableList (com.google.common.collect.ImmutableList)1 ValidationId (com.yahoo.config.application.api.ValidationId)1 ValidationOverrides (com.yahoo.config.application.api.ValidationOverrides)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1