Update method for deleting deployment
This commit is contained in:
parent
bf75dc8acc
commit
55e238d0b9
@ -465,8 +465,6 @@ export class Database {
|
|||||||
id: organizationId
|
id: organizationId
|
||||||
});
|
});
|
||||||
|
|
||||||
newProject.subDomain = `${newProject.name}.${this.projectDomain}`;
|
|
||||||
|
|
||||||
return projectRepository.save(newProject);
|
return projectRepository.save(newProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +138,9 @@ export class Deployment {
|
|||||||
@Column('boolean', { default: false })
|
@Column('boolean', { default: false })
|
||||||
isCurrent!: boolean;
|
isCurrent!: boolean;
|
||||||
|
|
||||||
|
@Column('varchar', { nullable: true })
|
||||||
|
baseDomain!: string | null;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
enum: DeploymentStatus
|
enum: DeploymentStatus
|
||||||
})
|
})
|
||||||
|
@ -67,8 +67,8 @@ export class Project {
|
|||||||
@Column('varchar')
|
@Column('varchar')
|
||||||
icon!: string;
|
icon!: string;
|
||||||
|
|
||||||
@Column('varchar')
|
@Column('varchar', { nullable: true })
|
||||||
subDomain!: string;
|
baseDomains!: string[] | null;
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
createdAt!: Date;
|
createdAt!: Date;
|
||||||
|
@ -194,7 +194,6 @@ export class Registry {
|
|||||||
})
|
})
|
||||||
).data.html_url;
|
).data.html_url;
|
||||||
|
|
||||||
// TODO: Set environment variables for each deployment (environment variables can't be set in application record)
|
|
||||||
const { applicationRecordId } =
|
const { applicationRecordId } =
|
||||||
await this.createApplicationRecord({
|
await this.createApplicationRecord({
|
||||||
appName: repo,
|
appName: repo,
|
||||||
@ -421,6 +420,7 @@ export class Registry {
|
|||||||
|
|
||||||
async createApplicationDeploymentRemovalRequest (data: {
|
async createApplicationDeploymentRemovalRequest (data: {
|
||||||
deploymentId: string;
|
deploymentId: string;
|
||||||
|
deployerLrn: string;
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
applicationDeploymentRemovalRequestId: string;
|
applicationDeploymentRemovalRequestId: string;
|
||||||
applicationDeploymentRemovalRequestData: ApplicationDeploymentRemovalRequest;
|
applicationDeploymentRemovalRequestData: ApplicationDeploymentRemovalRequest;
|
||||||
@ -428,7 +428,8 @@ export class Registry {
|
|||||||
const applicationDeploymentRemovalRequest = {
|
const applicationDeploymentRemovalRequest = {
|
||||||
type: APP_DEPLOYMENT_REMOVAL_REQUEST_TYPE,
|
type: APP_DEPLOYMENT_REMOVAL_REQUEST_TYPE,
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
deployment: data.deploymentId
|
deployment: data.deploymentId,
|
||||||
|
deployer: data.deployerLrn
|
||||||
};
|
};
|
||||||
|
|
||||||
const fee = parseGasAndFees(this.registryConfig.fee.gas, this.registryConfig.fee.fees);
|
const fee = parseGasAndFees(this.registryConfig.fee.gas, this.registryConfig.fee.fees);
|
||||||
|
@ -83,7 +83,7 @@ type Project {
|
|||||||
updatedAt: String!
|
updatedAt: String!
|
||||||
organization: Organization!
|
organization: Organization!
|
||||||
icon: String
|
icon: String
|
||||||
subDomain: String
|
baseDomains: [String!]
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProjectMember {
|
type ProjectMember {
|
||||||
@ -105,6 +105,7 @@ type Deployment {
|
|||||||
environment: Environment!
|
environment: Environment!
|
||||||
deployerLrn: String
|
deployerLrn: String
|
||||||
isCurrent: Boolean!
|
isCurrent: Boolean!
|
||||||
|
baseDomain: String
|
||||||
status: DeploymentStatus!
|
status: DeploymentStatus!
|
||||||
createdAt: String!
|
createdAt: String!
|
||||||
updatedAt: String!
|
updatedAt: String!
|
||||||
|
@ -210,10 +210,21 @@ export class Service {
|
|||||||
applicationDeploymentRecordId: record.id,
|
applicationDeploymentRecordId: record.id,
|
||||||
applicationDeploymentRecordData: record.attributes,
|
applicationDeploymentRecordData: record.attributes,
|
||||||
url: record.attributes.url,
|
url: record.attributes.url,
|
||||||
|
baseDomain,
|
||||||
status: DeploymentStatus.Ready,
|
status: DeploymentStatus.Ready,
|
||||||
isCurrent: deployment.environment === Environment.Production,
|
isCurrent: deployment.environment === Environment.Production,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const baseDomains = project.baseDomains || [];
|
||||||
|
|
||||||
|
if (!baseDomains.includes(baseDomain)) {
|
||||||
|
baseDomains.push(baseDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.db.updateProjectById(project.id, {
|
||||||
|
baseDomains
|
||||||
|
})
|
||||||
|
|
||||||
log(
|
log(
|
||||||
`Updated deployment ${deployment.id} with URL ${record.attributes.url}`,
|
`Updated deployment ${deployment.id} with URL ${record.attributes.url}`,
|
||||||
);
|
);
|
||||||
@ -1113,7 +1124,7 @@ export class Service {
|
|||||||
if (deployment && deployment.applicationDeploymentRecordId) {
|
if (deployment && deployment.applicationDeploymentRecordId) {
|
||||||
// If deployment is current, remove deployment for project subdomain as well
|
// If deployment is current, remove deployment for project subdomain as well
|
||||||
if (deployment.isCurrent) {
|
if (deployment.isCurrent) {
|
||||||
const currentDeploymentURL = `https://${deployment.project.subDomain}`;
|
const currentDeploymentURL = `https://${(deployment.project.name).toLowerCase()}.${deployment.baseDomain}`;
|
||||||
|
|
||||||
const deploymentRecords =
|
const deploymentRecords =
|
||||||
await this.registry.getDeploymentRecordsByFilter({
|
await this.registry.getDeploymentRecordsByFilter({
|
||||||
@ -1131,12 +1142,14 @@ export class Service {
|
|||||||
|
|
||||||
await this.registry.createApplicationDeploymentRemovalRequest({
|
await this.registry.createApplicationDeploymentRemovalRequest({
|
||||||
deploymentId: deploymentRecords[0].id,
|
deploymentId: deploymentRecords[0].id,
|
||||||
|
deployerLrn: deployment.deployerLrn
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const result =
|
const result =
|
||||||
await this.registry.createApplicationDeploymentRemovalRequest({
|
await this.registry.createApplicationDeploymentRemovalRequest({
|
||||||
deploymentId: deployment.applicationDeploymentRecordId,
|
deploymentId: deployment.applicationDeploymentRecordId,
|
||||||
|
deployerLrn: deployment.deployerLrn
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.db.updateDeploymentById(deployment.id, {
|
await this.db.updateDeploymentById(deployment.id, {
|
||||||
|
@ -73,7 +73,7 @@ async function main() {
|
|||||||
|
|
||||||
// Remove deployment for project subdomain if deployment is for production environment
|
// Remove deployment for project subdomain if deployment is for production environment
|
||||||
if (deployment.environment === Environment.Production) {
|
if (deployment.environment === Environment.Production) {
|
||||||
applicationDeploymentRecord.url = `https://${deployment.project.subDomain}`
|
applicationDeploymentRecord.url = `https://${deployment.project.name}.${deployment.baseDomain}`;
|
||||||
|
|
||||||
await registry.setRecord(
|
await registry.setRecord(
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ import { Badge } from 'components/shared/Badge';
|
|||||||
import { Button } from 'components/shared/Button';
|
import { Button } from 'components/shared/Button';
|
||||||
import {
|
import {
|
||||||
ArrowLeftCircleFilledIcon,
|
ArrowLeftCircleFilledIcon,
|
||||||
LinkChainIcon,
|
|
||||||
QuestionMarkRoundFilledIcon,
|
QuestionMarkRoundFilledIcon,
|
||||||
} from 'components/shared/CustomIcon';
|
} from 'components/shared/CustomIcon';
|
||||||
import { Heading } from 'components/shared/Heading';
|
import { Heading } from 'components/shared/Heading';
|
||||||
@ -55,22 +54,6 @@ const Id = () => {
|
|||||||
<Heading as="h3" className="font-medium text-xl">
|
<Heading as="h3" className="font-medium text-xl">
|
||||||
{isAuction? 'Project created successfully.' : 'Project deployed successfully.'}
|
{isAuction? 'Project created successfully.' : 'Project deployed successfully.'}
|
||||||
</Heading>
|
</Heading>
|
||||||
{!isAuction && (
|
|
||||||
<p className="flex flex-col items-center lg:flex-row font-sans gap-0.5 lg:gap-2 text-sm text-elements-high-em">
|
|
||||||
Your project has been deployed at{' '}
|
|
||||||
<Button
|
|
||||||
className="no-underline text-elements-link"
|
|
||||||
// TODO: use dynamic value
|
|
||||||
href={project ? `https://${project.subDomain}` : ''}
|
|
||||||
as="a"
|
|
||||||
variant="link-emphasized"
|
|
||||||
external
|
|
||||||
leftIcon={<LinkChainIcon />}
|
|
||||||
>
|
|
||||||
{project.subDomain}
|
|
||||||
</Button>
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Card */}
|
{/* Card */}
|
||||||
|
@ -129,12 +129,15 @@ const OverviewTabPanel = () => {
|
|||||||
<Heading className="text-lg leading-6 font-medium truncate">
|
<Heading className="text-lg leading-6 font-medium truncate">
|
||||||
{project.name}
|
{project.name}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
{project.baseDomains && project.baseDomains.length > 0 && project.baseDomains.map((baseDomain, index) => (
|
||||||
<a
|
<a
|
||||||
href={`https://${project.subDomain}`}
|
key={index}
|
||||||
|
href={`https://${project.name}.${baseDomain}`}
|
||||||
className="text-sm text-elements-low-em tracking-tight truncate"
|
className="text-sm text-elements-low-em tracking-tight truncate"
|
||||||
>
|
>
|
||||||
{project.subDomain}
|
{baseDomain}
|
||||||
</a>
|
</a>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<OverviewInfo label="Domain" icon={<GlobeIcon />}>
|
<OverviewInfo label="Domain" icon={<GlobeIcon />}>
|
||||||
|
@ -102,7 +102,7 @@ export const deployment0: Deployment = {
|
|||||||
domain: domain0,
|
domain: domain0,
|
||||||
commitMessage: 'Commit Message',
|
commitMessage: 'Commit Message',
|
||||||
createdBy: user,
|
createdBy: user,
|
||||||
deployerLrn: 'lrn://deepstack-test4/deployers/webapp-deployer-api.test4.wireitin.com',
|
deployerLrn: 'lrn://deployer.apps.snowballtools.com ',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const project: Project = {
|
export const project: Project = {
|
||||||
@ -121,8 +121,8 @@ export const project: Project = {
|
|||||||
template: 'Template',
|
template: 'Template',
|
||||||
members: [member],
|
members: [member],
|
||||||
auctionId: '7553538436710373822151221341b43f577e07b0525d083cc9b2de98890138a1',
|
auctionId: '7553538436710373822151221341b43f577e07b0525d083cc9b2de98890138a1',
|
||||||
deployerLrns: ['lrn://deepstack-test4/deployers/webapp-deployer-api.test4.wireitin.com', 'lrn://wireitin/deployers/webapp-deployer-api.wireitin.com'],
|
deployerLrns: ['lrn://deployer.apps.snowballtools.com '],
|
||||||
webhooks: ['beepboop'],
|
webhooks: ['beepboop'],
|
||||||
icon: 'Icon',
|
icon: 'Icon',
|
||||||
subDomain: 'SubDomain',
|
baseDomains: ['baseDomain'],
|
||||||
};
|
};
|
||||||
|
3
packages/gql-client/dist/index.d.mts
vendored
3
packages/gql-client/dist/index.d.mts
vendored
@ -94,6 +94,7 @@ type Deployment = {
|
|||||||
deployerLrn: string;
|
deployerLrn: string;
|
||||||
environment: Environment;
|
environment: Environment;
|
||||||
isCurrent: boolean;
|
isCurrent: boolean;
|
||||||
|
baseDomain?: string;
|
||||||
status: DeploymentStatus;
|
status: DeploymentStatus;
|
||||||
createdBy: User;
|
createdBy: User;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
@ -158,7 +159,7 @@ type Project = {
|
|||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
organization: Organization;
|
organization: Organization;
|
||||||
icon: string;
|
icon: string;
|
||||||
subDomain: string;
|
baseDomains?: string[] | null;
|
||||||
};
|
};
|
||||||
type GetProjectMembersResponse = {
|
type GetProjectMembersResponse = {
|
||||||
projectMembers: ProjectMember[];
|
projectMembers: ProjectMember[];
|
||||||
|
3
packages/gql-client/dist/index.d.ts
vendored
3
packages/gql-client/dist/index.d.ts
vendored
@ -94,6 +94,7 @@ type Deployment = {
|
|||||||
deployerLrn: string;
|
deployerLrn: string;
|
||||||
environment: Environment;
|
environment: Environment;
|
||||||
isCurrent: boolean;
|
isCurrent: boolean;
|
||||||
|
baseDomain?: string;
|
||||||
status: DeploymentStatus;
|
status: DeploymentStatus;
|
||||||
createdBy: User;
|
createdBy: User;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
@ -158,7 +159,7 @@ type Project = {
|
|||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
organization: Organization;
|
organization: Organization;
|
||||||
icon: string;
|
icon: string;
|
||||||
subDomain: string;
|
baseDomains?: string[] | null;
|
||||||
};
|
};
|
||||||
type GetProjectMembersResponse = {
|
type GetProjectMembersResponse = {
|
||||||
projectMembers: ProjectMember[];
|
projectMembers: ProjectMember[];
|
||||||
|
7
packages/gql-client/dist/index.js
vendored
7
packages/gql-client/dist/index.js
vendored
@ -83,7 +83,7 @@ query ($projectId: String!) {
|
|||||||
repository
|
repository
|
||||||
webhooks
|
webhooks
|
||||||
icon
|
icon
|
||||||
subDomain
|
baseDomains
|
||||||
organization {
|
organization {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
@ -97,6 +97,7 @@ query ($projectId: String!) {
|
|||||||
id
|
id
|
||||||
branch
|
branch
|
||||||
isCurrent
|
isCurrent
|
||||||
|
baseDomain
|
||||||
status
|
status
|
||||||
updatedAt
|
updatedAt
|
||||||
commitHash
|
commitHash
|
||||||
@ -133,11 +134,12 @@ query ($organizationSlug: String!) {
|
|||||||
repository
|
repository
|
||||||
updatedAt
|
updatedAt
|
||||||
icon
|
icon
|
||||||
subDomain
|
baseDomains
|
||||||
deployments {
|
deployments {
|
||||||
id
|
id
|
||||||
branch
|
branch
|
||||||
isCurrent
|
isCurrent
|
||||||
|
baseDomain
|
||||||
status
|
status
|
||||||
updatedAt
|
updatedAt
|
||||||
commitHash
|
commitHash
|
||||||
@ -186,6 +188,7 @@ query ($projectId: String!) {
|
|||||||
deployerLrn
|
deployerLrn
|
||||||
environment
|
environment
|
||||||
isCurrent
|
isCurrent
|
||||||
|
baseDomain
|
||||||
status
|
status
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
|
2
packages/gql-client/dist/index.js.map
vendored
2
packages/gql-client/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
7
packages/gql-client/dist/index.mjs
vendored
7
packages/gql-client/dist/index.mjs
vendored
@ -55,7 +55,7 @@ query ($projectId: String!) {
|
|||||||
repository
|
repository
|
||||||
webhooks
|
webhooks
|
||||||
icon
|
icon
|
||||||
subDomain
|
baseDomains
|
||||||
organization {
|
organization {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
@ -69,6 +69,7 @@ query ($projectId: String!) {
|
|||||||
id
|
id
|
||||||
branch
|
branch
|
||||||
isCurrent
|
isCurrent
|
||||||
|
baseDomain
|
||||||
status
|
status
|
||||||
updatedAt
|
updatedAt
|
||||||
commitHash
|
commitHash
|
||||||
@ -105,11 +106,12 @@ query ($organizationSlug: String!) {
|
|||||||
repository
|
repository
|
||||||
updatedAt
|
updatedAt
|
||||||
icon
|
icon
|
||||||
subDomain
|
baseDomains
|
||||||
deployments {
|
deployments {
|
||||||
id
|
id
|
||||||
branch
|
branch
|
||||||
isCurrent
|
isCurrent
|
||||||
|
baseDomain
|
||||||
status
|
status
|
||||||
updatedAt
|
updatedAt
|
||||||
commitHash
|
commitHash
|
||||||
@ -158,6 +160,7 @@ query ($projectId: String!) {
|
|||||||
deployerLrn
|
deployerLrn
|
||||||
environment
|
environment
|
||||||
isCurrent
|
isCurrent
|
||||||
|
baseDomain
|
||||||
status
|
status
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
|
2
packages/gql-client/dist/index.mjs.map
vendored
2
packages/gql-client/dist/index.mjs.map
vendored
File diff suppressed because one or more lines are too long
@ -29,7 +29,7 @@ query ($projectId: String!) {
|
|||||||
repository
|
repository
|
||||||
webhooks
|
webhooks
|
||||||
icon
|
icon
|
||||||
subDomain
|
baseDomains
|
||||||
organization {
|
organization {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
@ -43,6 +43,7 @@ query ($projectId: String!) {
|
|||||||
id
|
id
|
||||||
branch
|
branch
|
||||||
isCurrent
|
isCurrent
|
||||||
|
baseDomain
|
||||||
status
|
status
|
||||||
updatedAt
|
updatedAt
|
||||||
commitHash
|
commitHash
|
||||||
@ -80,11 +81,12 @@ query ($organizationSlug: String!) {
|
|||||||
repository
|
repository
|
||||||
updatedAt
|
updatedAt
|
||||||
icon
|
icon
|
||||||
subDomain
|
baseDomains
|
||||||
deployments {
|
deployments {
|
||||||
id
|
id
|
||||||
branch
|
branch
|
||||||
isCurrent
|
isCurrent
|
||||||
|
baseDomain
|
||||||
status
|
status
|
||||||
updatedAt
|
updatedAt
|
||||||
commitHash
|
commitHash
|
||||||
@ -135,6 +137,7 @@ query ($projectId: String!) {
|
|||||||
deployerLrn
|
deployerLrn
|
||||||
environment
|
environment
|
||||||
isCurrent
|
isCurrent
|
||||||
|
baseDomain
|
||||||
status
|
status
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
|
@ -108,6 +108,7 @@ export type Deployment = {
|
|||||||
deployerLrn: string;
|
deployerLrn: string;
|
||||||
environment: Environment;
|
environment: Environment;
|
||||||
isCurrent: boolean;
|
isCurrent: boolean;
|
||||||
|
baseDomain?: string;
|
||||||
status: DeploymentStatus;
|
status: DeploymentStatus;
|
||||||
createdBy: User;
|
createdBy: User;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
@ -177,7 +178,7 @@ export type Project = {
|
|||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
organization: Organization;
|
organization: Organization;
|
||||||
icon: string;
|
icon: string;
|
||||||
subDomain: string;
|
baseDomains?: string[] | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GetProjectMembersResponse = {
|
export type GetProjectMembersResponse = {
|
||||||
|
Loading…
Reference in New Issue
Block a user