git-js icon indicating copy to clipboard operation
git-js copied to clipboard

Docker K8s pod restarts | No logs no error shown

Open Harsh-Ajudia opened this issue 3 years ago • 0 comments

I have been using simple-git with my node.js in one of my recent projects. It works perfectly in my local setup machine but it fails to do so in the server setup. I will try to explain in detail here.

Process & Logic: The aim behind my project is to automate the monotonous task of the git process i.e. to automate everything from taking the clone of a repo, checking out some branch, adding files through code, doing git add . and then committing and pushing changes to the remote repo.

Issue: The pod restarts without any apparent reason no console log is generated. We do get SIGTERM signal and then it restarts

The Code structure pseudocode

//step: clone _________________________________________
simpleGit({
    baseDir: '',
    timeout: {
        block: 60 * 1000
    }
}).clone()
.then(res => {console})
.catch(err => {console})

// step: checkout (in case it is different) _________________________________________
simpleGit({
    baseDir: '',
    timeout: {
        block: 60 * 1000
    }
}).checkout(name)
.then(res => {console})
.catch(err => {console})

// step: make changes _________________________________________
// in this step we write all files with node fs module to the git baseDir

// step: add files _________________________________________
simpleGit({
    baseDir: '',
    timeout: {
        block: 60 * 1000
    }
}).add('.')
.then(res => {console})
.catch(err => {console})

// step: commit _________________________________________
simpleGit({
    baseDir: '',
    timeout: {
        block: 60 * 1000
    }
}).commit(message)
.then(res => {console})
.catch(err => {console})

// step: push _________________________________________
simpleGit({
    baseDir: '',
    timeout: {
        block: 60 * 1000
    }
}).push(remoteurl, branch)
.then(res => {console})
.catch(err => {console})
`

So this fails sometimes during clone, pull, or push randomly

Looking forward to hearing from you. 

Thanks

Harsh-Ajudia avatar Nov 11 '22 11:11 Harsh-Ajudia