Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/lib/azure/containerRegistryService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ describe("test container registries function", () => {
servicePrincipalPassword,
servicePrincipalTenantId,
subscriptionId,
RESOURCE_GROUP,
"test"
);
expect(res).toBeTruthy();
Expand All @@ -124,7 +123,6 @@ describe("test container registries function", () => {
servicePrincipalPassword,
servicePrincipalTenantId,
subscriptionId,
RESOURCE_GROUP,
"test"
);
expect(res).toBeFalsy();
Expand All @@ -144,7 +142,6 @@ describe("test container registries function", () => {
servicePrincipalPassword,
servicePrincipalTenantId,
subscriptionId,
RESOURCE_GROUP,
"test"
);
expect(res).toBeFalsy();
Expand Down
8 changes: 3 additions & 5 deletions src/lib/azure/containerRegistryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export const isExist = async (
servicePrincipalPassword: string,
servicePrincipalTenantId: string,
subscriptionId: string,
resourceGroup: string,
name: string
): Promise<boolean> => {
const registries = await getContainerRegistries(
Expand All @@ -127,7 +126,7 @@ export const isExist = async (
);

return (registries || []).some(
r => r.resourceGroup === resourceGroup && r.name === name
r => r.name === name // ACR name will be unique across Azure so only check the name.
);
};

Expand Down Expand Up @@ -158,15 +157,14 @@ export const create = async (
servicePrincipalPassword,
servicePrincipalTenantId,
subscriptionId,
resourceGroup,
name
);

if (exist) {
logger.info(
`Azure container registry, ${name} in ${resourceGroup} already existed`
`Azure container registry, ${name} already existed in subscription`
);
return false;
return true;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be false because we want to indicate that the command does not create the ACR in the setup.log

}
await getClient(
servicePrincipalId,
Expand Down
35 changes: 14 additions & 21 deletions src/lib/setup/helmTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ image:
tag: latest
pullPolicy: IfNotPresent

serviceName: "service"

service:
type: ClusterIP
port: 80
Expand All @@ -21,14 +23,13 @@ export const mainTemplate = `---
apiVersion: apps/v1
kind: Deployment
metadata:
name: { { .Chart.Name } }
name: {{ .Chart.Name }}
spec:
replicas: { { .Values.replicaCount } }
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: { { .Chart.Name } }
app.kubernetes.io/instance: { { .Release.Name } }
minReadySeconds: { { .Values.minReadySeconds } }
app: {{ .Values.serviceName }}
minReadySeconds: {{ .Values.minReadySeconds }}
strategy:
type: RollingUpdate # describe how we do rolling updates
rollingUpdate:
Expand All @@ -37,31 +38,23 @@ spec:
template:
metadata:
labels:
app: { { .Chart.Name } }
app.kubernetes.io/name: { { .Chart.Name } }
app.kubernetes.io/instance: { { .Release.Name } }
annotations:
prometheus.io/port: "{{ .Values.service.containerPort}}"
prometheus.io/scrape: "true"
app: {{ .Values.serviceName }}
spec:
containers:
- name: { { .Chart.Name } }
- name: {{ .Values.serviceName }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: { { .Values.image.pullPolicy } }
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: { { .Values.service.containerPort } }
- containerPort: {{ .Values.service.containerPort }}
---
apiVersion: v1
kind: Service
metadata:
name: { { .Chart.Name } }
labels:
app: { { .Chart.Name } }
name: {{ .Values.serviceName }}
spec:
type: LoadBalancer
ports:
- port: 8080
name: http
- port: {{ .Values.service.port }}
protocol: TCP
selector:
app: { { .Chart.Name } }
app: {{ .Values.serviceName }}
`;
10 changes: 5 additions & 5 deletions src/lib/setup/pipelineService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const pollForPipelineStatus = async (
} while (!build || build.result === 0);
};

const deletePipleLineIfExist = async (
const deletePipelineIfExist = async (
buildApi: IBuildApi,
rc: RequestContext,
pipelineName: string
Expand Down Expand Up @@ -198,7 +198,7 @@ export const createHLDtoManifestPipeline = async (
const pipelineName = `${HLD_REPO}-to-${MANIFEST_REPO}`;

try {
await deletePipleLineIfExist(buildApi, rc, pipelineName);
await deletePipelineIfExist(buildApi, rc, pipelineName);
await installHldToManifestPipeline({
buildScriptUrl: BUILD_SCRIPT_URL,
devopsProject: rc.projectName,
Expand Down Expand Up @@ -231,7 +231,7 @@ export const createLifecyclePipeline = async (
const pipelineName = APP_REPO_LIFECYCLE;

try {
await deletePipleLineIfExist(buildApi, rc, pipelineName);
await deletePipelineIfExist(buildApi, rc, pipelineName);

await installLifecyclePipeline({
buildScriptUrl: BUILD_SCRIPT_URL,
Expand Down Expand Up @@ -264,11 +264,11 @@ export const createBuildPipeline = async (
const pipelineName = APP_REPO_BUILD;

try {
await deletePipleLineIfExist(buildApi, rc, pipelineName);
await deletePipelineIfExist(buildApi, rc, pipelineName);

await installBuildUpdatePipeline(
APP_REPO,
path.join(APP_REPO, SERVICE_PIPELINE_FILENAME),
path.join(".", SERVICE_PIPELINE_FILENAME),
{
buildScriptUrl: BUILD_SCRIPT_URL,
devopsProject: rc.projectName,
Expand Down
8 changes: 4 additions & 4 deletions src/lib/setup/scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export const initService = async (
rc: RequestContext,
repoName: string
): Promise<void> => {
await createService(".", repoName, {
await createService(".", ".", {
displayName: repoName,
gitPush: false,
helmChartChart: "",
Expand All @@ -217,9 +217,9 @@ export const initService = async (
helmConfigBranch: "master",
helmConfigGit: getAzureRepoUrl(rc.orgName, rc.projectName, HELM_REPO),
helmConfigPath: `${repoName}/chart`,
k8sBackend: "",
k8sBackend: `${repoName}-svc`,
k8sBackendPort: "80",
k8sPort: 0,
k8sPort: 80,
maintainerEmail: "",
maintainerName: "",
middlewares: "",
Expand Down Expand Up @@ -249,7 +249,7 @@ export const appRepo = async (
rc.workspace
);

await projectInitialize(".");
await projectInitialize(".", { defaultRing: "master" }); //How is master set normally?
await setupVariableGroup(rc);
await initService(rc, repoName);
await git.add("./*");
Expand Down