Skip to content

Commit

Permalink
feat: Use beta endpoint when deploying to beta env (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
OysteinVesth authored May 6, 2024
1 parent 705899f commit cb73e1e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/delete.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import core = require("@actions/core");
import {deleteDeployment} from "./apiService";
import { getDeploymentUri } from "./utils";

const run = async () => {
console.log("Running rancher2 deployment");
Expand All @@ -9,8 +10,7 @@ const run = async () => {
const module = core.getInput('module');
const httpResource = "container-upgradev3";

const deploymentUri =
process.env.DEPLOYMENT_URI || "https://deployment.api.24sevenoffice.com";
const deploymentUri = getDeploymentUri(env)
console.log("Using url ",deploymentUri);


Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import core = require("@actions/core");
import { context } from "@actions/github";
import { deploy, checkStatus } from "./apiService";
import { ProbeConfig, VolumeConfig, VolumeMountConfig } from "./types";
import { getDeploymentUri } from "./utils";

const getDeploymentType = (type: string): string => {
switch (type) {
Expand Down Expand Up @@ -87,8 +88,7 @@ const run = async () => {
const branch =
context.ref.replace("refs/heads/", "") ||
context.ref.replace("refs/tags/", "");
const deploymentUri =
process.env.DEPLOYMENT_URI || "https://deployment.api.24sevenoffice.com";
const deploymentUri = getDeploymentUri(env)
console.log("Using url ", deploymentUri);
const secrets = {
...JSON.parse(core.getInput("secrets_string") || "{}"),
Expand Down
10 changes: 10 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const getDeploymentUri = (env: string) => {
if (process.env.DEPLOYMENT_URI) {
return process.env.DEPLOYMENT_URI
}

if (env.toLowerCase() === 'beta') {
return "https://deployment-beta.api.24sevenoffice.com"
}
return "https://deployment.api.24sevenoffice.com"
}

0 comments on commit cb73e1e

Please sign in to comment.