Skip to content
Open
Show file tree
Hide file tree
Changes from 11 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
2 changes: 1 addition & 1 deletion configs/.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ HASHIDS_LENGTH=6
HASHIDS_SALT=VvCCYj8x3xaHs44QiDp9
HELLO_RUNNABLE_GITHUB_ID=10224339
LOG_ERRORS=true
LOG_LEVEL=error
LOG_LEVEL=trace
MAX_FILE_DOWNLOAD=52428800
MAX_PAGE_LIMIT=200
MESSENGER_NAMESPACE=runnable:api:messenger:
Expand Down
3 changes: 2 additions & 1 deletion lib/models/mongo/context-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ ContextVersionSchema.statics.createWithNewInfraCode = function (props, infraCode
})
.catch((err) => {
log.error({ err }, 'failed to save infraCodeVersion or contextVersion')
infraCodeVersion.bucket().removeSourceDir(noop)
infraCodeVersion.bucket()
infraCodeVersion.removeSourceDir(noop)
throw err
})
}
Expand Down
34 changes: 21 additions & 13 deletions scripts/seed-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ const rabbitMQ = require('models/rabbitmq/index')
const sinon = require('sinon')
const User = require('models/mongo/user')

const sources = [{
const blankSource = {
name: 'Blank',
isSource: true,
body: '# Empty Dockerfile!\n'
}
const sources = [
{
name: 'PHP',
isTemplate: true,
isSource: true,
Expand Down Expand Up @@ -96,7 +102,6 @@ const sources = [{
}]
sinon.stub(messenger)

var ctx = {}
var createdBy

/*
Expand All @@ -117,8 +122,16 @@ function main () {
.then(user => {
createdBy = { github: user.accounts.github.id }
return findOrCreateBlankContext()
.tap(function (blankIcv) {
ctx.blankIcv = blankIcv
.tap((res) => {
let blankIcv = res[0]
let blankContext = res[1]
return createContextVersion(blankSource, blankContext, blankIcv)
.then(cv => {
return createAndBuildBuild(user, blankSource, cv)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why are you making a build with the blank dockerfile? It shouldn't actually even work, since it's blank.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's what I needed to do to get this thing working. Basically, certain images need a context version to be based off (rethinkdb) and this solves that problem.

})
})
.tap(function (res) {
const blankIcv = res[0]
return Promise.each(sources, function (source) {
return findOrCreateContext(source)
.then(context => {
Expand Down Expand Up @@ -154,19 +167,14 @@ function main () {
}

function findOrCreateBlankContext () {
const blankData = {
name: 'Blank',
isSource: true,
body: '# Empty Dockerfile!\n'
}
return findOrCreateContext(blankData)
return findOrCreateContext(blankSource)
.then(blankContext => {
return InfraCodeVersion.findOneAsync({ context: blankContext.id })
.then(blankIcv => {
if (!blankIcv) {
return createNewIcv(blankData, blankContext)
return createNewIcv(blankSource, blankContext)
}
return blankIcv
return [blankIcv, blankContext]
})
})
}
Expand Down Expand Up @@ -252,4 +260,4 @@ function createOrUpdateInstance (user, data, build) {
owner: createdBy
}, user)
})
}