add build arg rebuild=true

This commit is contained in:
ngxson
2023-05-19 11:35:00 +02:00
parent 9d0920f0fd
commit f0cdbc1e96
3 changed files with 16 additions and 2 deletions

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
scripts
.github
node_modules
data
Dockerfile.tmp

View File

@@ -3,7 +3,7 @@ name: Build and push
on:
push:
branches:
- test_ci
- main
workflow_dispatch:
inputs:
rebuild:

View File

@@ -4,6 +4,9 @@ const { spawn } = require('child_process');
const ACCEPTED_TAGS_FROM = '2.17.0';
const UPSTREAM_REPO = 'portainer/portainer-ce';
const OUTPUT_REPO = 'ngxson/portainer-ce-without-annoying';
const NUMBER_OF_TAGS_REBUILD = 5;
const shouldRebuild = !!process.argv.join(' ').match(/rebuild=true/);
function build_and_push(tag) {
const cwd = path.join(__dirname, '..');
@@ -65,7 +68,12 @@ async function processRepos(repoA, repoB) {
const tagsB = await fetchTags(repoB);
console.log({ tagsA, tagsB });
const tagDifference = findTagDifference(tagsA, tagsB);
const tagDifference = shouldRebuild
? [...tagsB]
.sort((a, b) => semverToInt(b) - semverToInt(a)) // sort desc
.filter(t => t !== 'latest')
.slice(0, NUMBER_OF_TAGS_REBUILD)
: findTagDifference(tagsA, tagsB);
// added by me
const acceptTagsFrom = semverToInt(ACCEPTED_TAGS_FROM);