Skip to content

Commit

Permalink
upgrade pulumi version to 1.12.0 (sourcegraph#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggilmore authored Mar 10, 2020
1 parent 1b37067 commit 3116aec
Show file tree
Hide file tree
Showing 16 changed files with 431 additions and 162 deletions.
18 changes: 14 additions & 4 deletions .buildkite/hooks/pre-command
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#!/usr/bin/env bash

set -eu
cd $BUILDKITE_BUILD_CHECKOUT_PATH
pushd $(dirname "${BASH_SOURCE[0]}")/../..

echo "Installing asdf dependencies as defined in '$BUILDKITE_BUILD_CHECKOUT_PATH/.tool-versions':"
asdf install
TOOL_VERSION_FILES=()
mapfile -d $'\0' TOOL_VERSION_FILES < <(fd .tool-versions --hidden --absolute-path --print0)

asdf global kubectl 1.17.3
for file in "${TOOL_VERSION_FILES[@]}"
do
echo "Installing asdf dependencies as defined in ${file}:"
parent=$(dirname "${file}")
pushd "${parent}"

asdf install

popd
done

popd
2 changes: 2 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ steps:
command: .buildkite/verify-label.sh
- label: ":k8s:"
command: .buildkite/verify-rbac-labels.sh
- label: ':lipstick:'
command: .buildkite/prettier-check.sh

- wait

Expand Down
10 changes: 10 additions & 0 deletions .buildkite/prettier-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

cd $(dirname "${BASH_SOURCE[0]}")/..
set -euxo pipefail

cd tests/integration/fresh/step1

yarn

yarn run prettier-check
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.16.1
5 changes: 5 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
golang 1.14
yarn 1.22.4
kubectl 1.17.3
pulumi 1.12.0
fd 7.4.0
3 changes: 0 additions & 3 deletions .tools-versions

This file was deleted.

9 changes: 3 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
module github.com/sourcegraph/deploy-sourcegraph

go 1.13
go 1.14

require (
github.com/docker/docker v1.13.1 // indirect
github.com/frankban/quicktest v1.4.2
github.com/pulumi/pulumi v1.0.0
github.com/pulumi/pulumi v1.12.0
github.com/sethgrid/pester v0.0.0-20190127155807-68a33a018ad0
github.com/stretchr/testify v1.4.0 // indirect
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect
google.golang.org/appengine v1.5.0 // indirect
)

replace golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373 => golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
replace github.com/Azure/go-autorest => github.com/Azure/go-autorest v12.4.3+incompatible
258 changes: 154 additions & 104 deletions go.sum

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/integration/fresh/step1/.nvrmc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.16.1
2 changes: 2 additions & 0 deletions tests/integration/fresh/step1/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarn 1.22.4
pulumi 1.12.0
2 changes: 1 addition & 1 deletion tests/integration/fresh/step1/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ export const k8sProvider = new k8s.Provider(`${name}-provider`, {
kubeconfig,
})

export const clusterName = cluster.name
export const clusterName = cluster.name
73 changes: 39 additions & 34 deletions tests/integration/fresh/step1/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as os from 'os'
import * as path from 'path'

import * as fg from 'fast-glob'
import * as k8s from '@pulumi/kubernetes'

import { k8sProvider } from './cluster'
import { deploySourcegraphRoot, gcpUsername } from './config'
import * as fs from "fs";

const clusterAdmin = new k8s.rbac.v1.ClusterRoleBinding(
'cluster-admin-role-binding',
Expand Down Expand Up @@ -48,43 +48,48 @@ const storageClass = new k8s.storage.v1.StorageClass(
{ provider: k8sProvider }
)

const getAllButKustomizeYAMLFiles = dir =>
fs.readdirSync(dir).reduce((files, file) => {
if (file == 'kustomization.yaml') {
return files;
}
const ext = file.substr(file.lastIndexOf('.') + 1);
const name = path.join(dir, file);
const isDirectory = fs.statSync(name).isDirectory();
if (!isDirectory && ext != 'yaml') {
return files;
}
return isDirectory ? [...files, ...getAllButKustomizeYAMLFiles(name)] : [...files, name];
}, []);
const globOptions = {
ignore: ['**/kustomization.yaml'],
}

const baseDeployment = new k8s.yaml.ConfigGroup(
'base',
{
files: getAllButKustomizeYAMLFiles(path.posix.join(deploySourcegraphRoot, 'base')),
},
{
providers: { kubernetes: k8sProvider },
dependsOn: [clusterAdmin, storageClass],
}
const baseFiles = fg(`${path.posix.join(deploySourcegraphRoot, 'base')}/**/*.yaml`, globOptions)

const baseDeployment = baseFiles.then(
files =>
new k8s.yaml.ConfigGroup(
'base',
{
files,
},
{
providers: { kubernetes: k8sProvider },
dependsOn: [clusterAdmin, storageClass],
}
)
)

const ingressNginx = new k8s.yaml.ConfigGroup(
'ingress-nginx',
{
files: `${path.posix.join(deploySourcegraphRoot, 'configure', 'ingress-nginx')}/**/*.yaml`,
},
{ providers: { kubernetes: k8sProvider }, dependsOn: clusterAdmin }
const ingressNginxFiles = fg(
`${path.posix.join(deploySourcegraphRoot, 'configure', 'ingress-nginx')}/**/*.yaml`,
globOptions
)

export const ingressIP = ingressNginx
.getResource('v1/Service', 'ingress-nginx', 'ingress-nginx')
.apply(svc => svc.status)
.apply(status => status.loadBalancer.ingress.map(i => i.ip))
.apply(ips => (ips.length === 1 ? ips[0] : undefined))
const ingressNginx = ingressNginxFiles.then(
files =>
new k8s.yaml.ConfigGroup(
'ingress-nginx',
{
files,
},
{ providers: { kubernetes: k8sProvider }, dependsOn: clusterAdmin }
)
)

export const ingressIP = ingressNginx.then(ingress =>
ingress
.getResource('v1/Service', 'ingress-nginx', 'ingress-nginx')
.apply(svc => svc.status)
.apply(status => status.loadBalancer.ingress.map(i => i.ip))
.apply(ips => (ips.length === 1 ? ips[0] : undefined))
)

export * from './cluster'
7 changes: 6 additions & 1 deletion tests/integration/fresh/step1/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
{
"name": "steps",
"scripts": {
"prettier": "prettier '**/{*.{js?(on),ts?(x),graphql,md,scss},.*.js?(on)}' --write --list-different --config prettier.config.js",
"prettier-check": "yarn -s run prettier --write=false"
},
"devDependencies": {
"@sourcegraph/prettierrc": "3.0.1",
"@types/node": "latest",
"fast-glob": "^3.2.2",
"prettier": "1.18.2",
"tslint": "5.19.0",
"tslint-config-prettier": "1.18.0"
},
"dependencies": {
"@pulumi/gcp": "1.3.0",
"@pulumi/kubernetes": "1.2.2",
"@pulumi/pulumi": "1.3.1",
"@pulumi/pulumi": "1.12.0",
"change-case": "^3.1.0"
}
}
2 changes: 1 addition & 1 deletion tests/integration/fresh/step1/prettier.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require("@sourcegraph/prettierrc");
module.exports = require('@sourcegraph/prettierrc')
Loading

0 comments on commit 3116aec

Please sign in to comment.