Hi,
I want to keep auto-publish as turned off, but when I open the netlify app after a few days, it is turned back on by itself.
Site Name: app.thegaas.com
Hi,
I want to keep auto-publish as turned off, but when I open the netlify app after a few days, it is turned back on by itself.
Site Name: app.thegaas.com
hi, can you pop some screenshots of your build settings, please? thanks!
Hey, here you go
https://drive.google.com/drive/folders/1YRuFTrZcmgVForFS7AzOp82r5ofAdDtx?usp=sharing
thanks. one of the screenshots is showing that your builds are active. to clarify, you had them turned off, and then the setting was reset back to active? thanks
I want the builds to be active but auto-publish to be off. I turned off auto-publish that turns back on by itself.
Since we’re already working on this in the helpdesk, let’s keep the conversation there. I think we weren’t when you started this thread but since we are now, I’ll link them and we can post a followup here once we figure out how it is happening.
Hey @fool, This is the script that we use to get the latest build and trigger a publish, do you see anything here that might be causing this issue?
const {client, sites} = require("./config");
async function main(siteId, gitCommitSha) {
const deploys = await client.listSiteDeploys({
site_id: siteId
})
const prodDeploys = deploys.filter(({ context }) => context === "production")
const idx = prodDeploys.findIndex(({ commit_ref }) => commit_ref && commit_ref.startsWith(gitCommitSha));
if (idx === -1) {
console.error("Could not find Netlify Deploy");
process.exit(1)
}
const deployCandidates = prodDeploys.slice(idx)
for(const deployCandidate of deployCandidates) {
if (deployCandidate.state === 'error' && deployCandidate.error_message.match(/no content change/)) {
continue;
}
if (deployCandidate.state !== 'ready') {
console.error("Could not find a valid deploy candidate", deployCandidate.error)
process.exit(1)
}
console.log(`##teamcity[setParameter name='netlifyDeployID' value='${deployCandidate.id}']`)
return
}
// Should never come here
console.error("Ran out of deploy candidates... It should never have come here")
process.exit(1)
}
main(sites[process.argv[2]], process.argv[3])
const { client, sites } = require("./config");
async function main(siteId, deployId) {
await client.restoreSiteDeploy({
site_id: siteId,
deploy_id: deployId
})
}
main(sites[process.argv[2]], process.argv[3])
Also, we’re triggering a publish whenever a PR is merged into the master. Is it the case that whenever a publish is triggered, the auto-publish is permanently set to on
from off
?
To summarize:
on
instead of off
even when we didn’t do soIt seems to me that whenever a publish is triggered (basically when we merge a PR to master), the auto-publish gets set to on by itself.
We want to keep the auto-publish to be set to off and publish only when we triggered it.
Based on the results of our team’s investigation, yes, when you use the restore call ONLY on an already locked and published deploy, locking is turned off.
So, don’t do that and things will work as you expect Or, if you can’t not do that for some reason (I’d work on fixing that problem!) you can re-lock after every restore call - that will mean the window for deploys being unlocked is the duration between making the restore call and relocking, which would hopefully be milliseconds.
Thank you @fool, I’m locking the deploy now after every publish and this seems to be doing the job.