Skip to content

Commit

Permalink
fix(k8s): fix some issues with syncing build context to remote cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Jun 13, 2019
1 parent 33f9638 commit a5ed2cf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
19 changes: 19 additions & 0 deletions garden-service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions garden-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"node-forge": "^0.8.2",
"normalize-url": "^4.3.0",
"p-queue": "^5.0.0",
"p-retry": "^4.1.0",
"path-is-inside": "^1.0.2",
"request": "^2.88.0",
"request-promise": "^4.2.4",
Expand Down
9 changes: 7 additions & 2 deletions garden-service/src/plugins/kubernetes/container/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import pRetry from "p-retry"
import { ContainerModule } from "../../container/config"
import { containerHelpers } from "../../container/helpers"
import { buildContainerModule, getContainerBuildStatus, getDockerBuildFlags } from "../../container/build"
Expand Down Expand Up @@ -166,8 +167,12 @@ const remoteBuild: BuildHandler = async (params) => {
const destination = `rsync://localhost:${syncFwd.localPort}/volume/${ctx.workingCopyId}/`

log.debug(`Syncing from ${src} to ${destination}`)
// TODO: use list of files from module version
await execa("rsync", ["-vrpztgo", "--relative", src, destination])

// We retry a couple of times, because we may get intermittent connection issues or concurrency issues
await pRetry(
() => execa("rsync", ["-vrpztgo", "--relative", "--delete", src, destination]),
{ retries: 3, minTimeout: 500 },
)

const localId = await containerHelpers.getLocalImageId(module)
const deploymentImageId = await containerHelpers.getDeploymentImageId(module, provider.config.deploymentRegistry)
Expand Down

0 comments on commit a5ed2cf

Please sign in to comment.