Skip to content

Commit

Permalink
release 1.0.23
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenchristopher-zip committed Sep 27, 2022
1 parent d63f9cb commit e0cc6d9
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spinnakerBundle {
pluginId = "zip.deployboard"
description = "Customization for Zip deploys"
provider = "https://github.com/Greenbax/zip-spinnaker-deployboard"
version = "1.0.22"
version = "1.0.23"
}

subprojects {
Expand Down
8 changes: 4 additions & 4 deletions plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"provider": "https://github.com/Greenbax/zip-spinnaker-deployboard",
"releases": [
{
"version": "1.0.22",
"date": "2022-09-26T21:49:32.121432Z",
"version": "1.0.23",
"date": "2022-09-27T00:45:14.772613Z",
"requires": "gate>=0.0.0,orca>=0.0.0,deck>=0.0.0",
"sha512sum": "8a0d5264e3ff659b3ce08da8f319d27126cb244fbf5b52f9eb6ad38db948b3626020274d0fa5ab3e8443b9c6f4fcfd707c70583c0cfba86aad66af9b95452c49",
"sha512sum": "7b54eb28914f6a4246adeef6e05369381eae2c87b27122f89ca746f0727dfd0e8ce5ff100c80bda9f456749502b7482355fcd44feef40353eceea13024925e2e",
"state": "",
"url": "https://github.com/Greenbax/zip-spinnaker-deployboard/releases/download/v1.0.22/zip-spinnaker-deployboard.zip"
"url": "https://github.com/Greenbax/zip-spinnaker-deployboard/releases/download/v1.0.23/zip-spinnaker-deployboard.zip"
}
]
}
Expand Down
14 changes: 9 additions & 5 deletions zip-deployboard-deck/src/snapshots/SnapshotsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArrowDropDown, ArrowRight } from '@material-ui/icons';
import { ArrowDropDown, ArrowRight, Restore } from '@material-ui/icons';
import React from 'react';
import { Button } from 'react-bootstrap';
import { CheckmarkIcon, LoaderIcon } from 'react-hot-toast';
Expand Down Expand Up @@ -43,10 +43,11 @@ export const SnapshotsTable = ({
<thead>
<tr>
<th style={{ width: '5%' }}></th>
<th style={{ width: '10%' }}>Status</th>
<th style={{ width: '5%' }}>Status</th>
<th style={{ width: '15%' }}>Jenkins Buid Number</th>
<th style={{ width: '55%' }}>Commits</th>
<th style={{ width: '15%' }}>Actions</th>
<th style={{ width: '45%' }}>Commits</th>
<th style={{ width: '25%' }}>Docker Image Tag</th>
<th style={{ width: '5%' }}>Actions</th>
</tr>
</thead>

Expand All @@ -68,13 +69,16 @@ export const SnapshotsTable = ({
<LoaderIcon />
) : build.status === 'DEPLOYED' ? (
<CheckmarkIcon />
) : build.status === 'LAST_DEPLOYED' ? (
<Restore />
) : (
<></>
)}
</div>
</td>
<td>{build.buildNumber}</td>
<td>{getCommitSummary(build.commits)}</td>
<td>{build.dockerImage}</td>
<td>
<Button
onClick={(e) => {
Expand All @@ -88,7 +92,7 @@ export const SnapshotsTable = ({
</tr>
{expandedBuilds.has(build.buildNumber) && (
<tr>
<td colSpan={5}>
<td colSpan={6}>
<table className="table">
<thead>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ public void addCommit(Commit commit) {
this.commits.add(commit);
}

public void setStatus(String deployedImage, String deployingImage) {
if (this.getDockerImage().equals(deployedImage)) {
public void setDeployStatus(BranchStatus status) {
if (this.getDockerImage().equals(status.getDeployed())) {
this.setStatus("DEPLOYED");
} else if (this.getDockerImage().equals(deployingImage)) {
} else if (this.getDockerImage().equals(status.getDeploying())) {
this.setStatus("DEPLOYING");
} else if (this.getDockerImage().equals(status.getLastDeployed())) {
this.setStatus("LAST_DEPLOYED");
} else {
this.setStatus("NOT_DEPLOYED");
}
Expand All @@ -62,6 +64,7 @@ class Commit {
class BranchStatus {
private String deployed;
private String deploying;
private String lastDeployed;
}

@Extension
Expand Down Expand Up @@ -94,8 +97,6 @@ public HttpResponse handle(HttpRequest httpRequest) {
}

BranchStatus branchStatus = this.queryBranchStatus(branch);
String deployedImage = branchStatus.getDeployed();
String deployingImage = branchStatus.getDeploying();

QuerySpec spec = new QuerySpec().withScanIndexForward(false)
.withKeyConditionExpression("branch = :branch_name and #sort_key_name < :sort_key")
Expand Down Expand Up @@ -140,7 +141,7 @@ public HttpResponse handle(HttpRequest httpRequest) {
buildNumber,
dbItem.getString("dockerTag")
);
build.setStatus(deployedImage, deployingImage);
build.setDeployStatus(branchStatus);
builds.add(build);
currBuildNumber = buildNumber;
}
Expand Down Expand Up @@ -173,6 +174,8 @@ public BranchStatus queryBranchStatus(String branch) {
res.setDeployed(item.getString("image"));
} else if (status.equals("DEPLOYING")) {
res.setDeploying(item.getString("image"));
} else if (status.equals("LAST_DEPLOYED")) {
res.setLastDeployed(item.getString("image"));
}
}
return res;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.amazonaws.services.dynamodbv2.document.Item;
import com.amazonaws.services.dynamodbv2.document.Table;
import com.amazonaws.services.dynamodbv2.document.spec.DeleteItemSpec;
import com.amazonaws.services.dynamodbv2.document.spec.GetItemSpec;
import com.netflix.spinnaker.orca.api.pipeline.Task;
import com.netflix.spinnaker.orca.api.pipeline.TaskResult;
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution;
Expand All @@ -25,10 +26,25 @@ public TaskResult execute(StageExecution stage) {

// On successful build, update deployed field in dynamo.
if (context.getSuccess() != null) {
// Set currently deployed build as last deployed.
GetItemSpec getItemSpec = new GetItemSpec()
.withPrimaryKey("branch", context.getBranch(), "status", "DEPLOYED");
Item lastDeploy = table.getItem(getItemSpec);
if (lastDeploy != null) {
String lastDeployedImage = lastDeploy.getString("image");
Item item = new Item()
.withPrimaryKey("branch", context.getBranch(), "status", "LAST_DEPLOYED")
.withString("image", lastDeployedImage);
table.putItem(item);
}

// Update currently deployed build.
Item item = new Item()
.withPrimaryKey("branch", context.getBranch(), "status", "DEPLOYED")
.withString("image", context.getImage());
table.putItem(item);

// Delete deploying build.
DeleteItemSpec deleteSpec = new DeleteItemSpec()
.withPrimaryKey("branch", context.getBranch(), "status", "DEPLOYING");
table.deleteItem(deleteSpec);
Expand Down

0 comments on commit e0cc6d9

Please sign in to comment.