diff --git a/actions/push-images/__tests__/docker.test.ts b/actions/push-images/__tests__/docker.test.ts index 3f8b6257..626b5cd7 100644 --- a/actions/push-images/__tests__/docker.test.ts +++ b/actions/push-images/__tests__/docker.test.ts @@ -157,65 +157,129 @@ describe('buildCommands', () => { 'docker load -i /images/fluentd-2.9.4-linux-amd64.tar', 'docker tag grafana/fluentd:2.9.4-amd64 grafana/fluentd:latest-amd64', 'docker push grafana/fluentd:latest-amd64', + 'docker tag grafana/fluentd:2.9.4-amd64 grafana/fluentd:v2-amd64', + 'docker push grafana/fluentd:v2-amd64', + 'docker tag grafana/fluentd:2.9.4-amd64 grafana/fluentd:v2.9-amd64', + 'docker push grafana/fluentd:v2.9-amd64', 'docker push -a grafana/fluentd', 'docker manifest create grafana/fluentd:2.9.4 grafana/fluentd:2.9.4-amd64', 'docker manifest push grafana/fluentd:2.9.4', 'docker manifest create grafana/fluentd:latest grafana/fluentd:latest-amd64', 'docker manifest push grafana/fluentd:latest', + 'docker manifest create grafana/fluentd:v2 grafana/fluentd:v2-amd64', + 'docker manifest push grafana/fluentd:v2', + 'docker manifest create grafana/fluentd:v2.9 grafana/fluentd:v2.9-amd64', + 'docker manifest push grafana/fluentd:v2.9', 'docker load -i /images/logcli-2.9.4-linux-amd64.tar', 'docker tag grafana/logcli:2.9.4-amd64 grafana/logcli:latest-amd64', 'docker push grafana/logcli:latest-amd64', + 'docker tag grafana/logcli:2.9.4-amd64 grafana/logcli:v2-amd64', + 'docker push grafana/logcli:v2-amd64', + 'docker tag grafana/logcli:2.9.4-amd64 grafana/logcli:v2.9-amd64', + 'docker push grafana/logcli:v2.9-amd64', 'docker load -i /images/logcli-2.9.4-linux-arm.tar', 'docker tag grafana/logcli:2.9.4-arm grafana/logcli:latest-arm', 'docker push grafana/logcli:latest-arm', + 'docker tag grafana/logcli:2.9.4-arm grafana/logcli:v2-arm', + 'docker push grafana/logcli:v2-arm', + 'docker tag grafana/logcli:2.9.4-arm grafana/logcli:v2.9-arm', + 'docker push grafana/logcli:v2.9-arm', 'docker load -i /images/logcli-2.9.4-linux-arm64.tar', 'docker tag grafana/logcli:2.9.4-arm64 grafana/logcli:latest-arm64', 'docker push grafana/logcli:latest-arm64', + 'docker tag grafana/logcli:2.9.4-arm64 grafana/logcli:v2-arm64', + 'docker push grafana/logcli:v2-arm64', + 'docker tag grafana/logcli:2.9.4-arm64 grafana/logcli:v2.9-arm64', + 'docker push grafana/logcli:v2.9-arm64', 'docker push -a grafana/logcli', 'docker manifest create grafana/logcli:2.9.4 grafana/logcli:2.9.4-amd64 grafana/logcli:2.9.4-arm grafana/logcli:2.9.4-arm64', 'docker manifest push grafana/logcli:2.9.4', 'docker manifest create grafana/logcli:latest grafana/logcli:latest-amd64 grafana/logcli:latest-arm grafana/logcli:latest-arm64', 'docker manifest push grafana/logcli:latest', + 'docker manifest create grafana/logcli:v2 grafana/logcli:v2-amd64 grafana/logcli:v2-arm grafana/logcli:v2-arm64', + 'docker manifest push grafana/logcli:v2', + 'docker manifest create grafana/logcli:v2.9 grafana/logcli:v2.9-amd64 grafana/logcli:v2.9-arm grafana/logcli:v2.9-arm64', + 'docker manifest push grafana/logcli:v2.9', 'docker load -i /images/logstash-2.9.4-linux-amd64.tar', 'docker tag grafana/logstash:2.9.4-amd64 grafana/logstash:latest-amd64', 'docker push grafana/logstash:latest-amd64', + 'docker tag grafana/logstash:2.9.4-amd64 grafana/logstash:v2-amd64', + 'docker push grafana/logstash:v2-amd64', + 'docker tag grafana/logstash:2.9.4-amd64 grafana/logstash:v2.9-amd64', + 'docker push grafana/logstash:v2.9-amd64', 'docker push -a grafana/logstash', 'docker manifest create grafana/logstash:2.9.4 grafana/logstash:2.9.4-amd64', 'docker manifest push grafana/logstash:2.9.4', 'docker manifest create grafana/logstash:latest grafana/logstash:latest-amd64', 'docker manifest push grafana/logstash:latest', + 'docker manifest create grafana/logstash:v2 grafana/logstash:v2-amd64', + 'docker manifest push grafana/logstash:v2', + 'docker manifest create grafana/logstash:v2.9 grafana/logstash:v2.9-amd64', + 'docker manifest push grafana/logstash:v2.9', 'docker load -i /images/loki-2.9.4-linux-amd64.tar', 'docker tag grafana/loki:2.9.4-amd64 grafana/loki:latest-amd64', 'docker push grafana/loki:latest-amd64', + 'docker tag grafana/loki:2.9.4-amd64 grafana/loki:v2-amd64', + 'docker push grafana/loki:v2-amd64', + 'docker tag grafana/loki:2.9.4-amd64 grafana/loki:v2.9-amd64', + 'docker push grafana/loki:v2.9-amd64', 'docker load -i /images/loki-2.9.4-linux-arm.tar', 'docker tag grafana/loki:2.9.4-arm grafana/loki:latest-arm', 'docker push grafana/loki:latest-arm', + 'docker tag grafana/loki:2.9.4-arm grafana/loki:v2-arm', + 'docker push grafana/loki:v2-arm', + 'docker tag grafana/loki:2.9.4-arm grafana/loki:v2.9-arm', + 'docker push grafana/loki:v2.9-arm', 'docker load -i /images/loki-2.9.4-linux-arm64.tar', 'docker tag grafana/loki:2.9.4-arm64 grafana/loki:latest-arm64', 'docker push grafana/loki:latest-arm64', + 'docker tag grafana/loki:2.9.4-arm64 grafana/loki:v2-arm64', + 'docker push grafana/loki:v2-arm64', + 'docker tag grafana/loki:2.9.4-arm64 grafana/loki:v2.9-arm64', + 'docker push grafana/loki:v2.9-arm64', 'docker push -a grafana/loki', 'docker manifest create grafana/loki:2.9.4 grafana/loki:2.9.4-amd64 grafana/loki:2.9.4-arm grafana/loki:2.9.4-arm64', 'docker manifest push grafana/loki:2.9.4', 'docker manifest create grafana/loki:latest grafana/loki:latest-amd64 grafana/loki:latest-arm grafana/loki:latest-arm64', 'docker manifest push grafana/loki:latest', + 'docker manifest create grafana/loki:v2 grafana/loki:v2-amd64 grafana/loki:v2-arm grafana/loki:v2-arm64', + 'docker manifest push grafana/loki:v2', + 'docker manifest create grafana/loki:v2.9 grafana/loki:v2.9-amd64 grafana/loki:v2.9-arm grafana/loki:v2.9-arm64', + 'docker manifest push grafana/loki:v2.9', 'docker load -i /images/loki-canary-2.9.4-linux-amd64.tar', 'docker tag grafana/loki-canary:2.9.4-amd64 grafana/loki-canary:latest-amd64', 'docker push grafana/loki-canary:latest-amd64', + 'docker tag grafana/loki-canary:2.9.4-amd64 grafana/loki-canary:v2-amd64', + 'docker push grafana/loki-canary:v2-amd64', + 'docker tag grafana/loki-canary:2.9.4-amd64 grafana/loki-canary:v2.9-amd64', + 'docker push grafana/loki-canary:v2.9-amd64', 'docker load -i /images/loki-canary-2.9.4-linux-arm.tar', 'docker tag grafana/loki-canary:2.9.4-arm grafana/loki-canary:latest-arm', 'docker push grafana/loki-canary:latest-arm', + 'docker tag grafana/loki-canary:2.9.4-arm grafana/loki-canary:v2-arm', + 'docker push grafana/loki-canary:v2-arm', + 'docker tag grafana/loki-canary:2.9.4-arm grafana/loki-canary:v2.9-arm', + 'docker push grafana/loki-canary:v2.9-arm', 'docker load -i /images/loki-canary-2.9.4-linux-arm64.tar', 'docker tag grafana/loki-canary:2.9.4-arm64 grafana/loki-canary:latest-arm64', 'docker push grafana/loki-canary:latest-arm64', + 'docker tag grafana/loki-canary:2.9.4-arm64 grafana/loki-canary:v2-arm64', + 'docker push grafana/loki-canary:v2-arm64', + 'docker tag grafana/loki-canary:2.9.4-arm64 grafana/loki-canary:v2.9-arm64', + 'docker push grafana/loki-canary:v2.9-arm64', 'docker push -a grafana/loki-canary', 'docker manifest create grafana/loki-canary:2.9.4 grafana/loki-canary:2.9.4-amd64 grafana/loki-canary:2.9.4-arm grafana/loki-canary:2.9.4-arm64', 'docker manifest push grafana/loki-canary:2.9.4', 'docker manifest create grafana/loki-canary:latest grafana/loki-canary:latest-amd64 grafana/loki-canary:latest-arm grafana/loki-canary:latest-arm64', - 'docker manifest push grafana/loki-canary:latest' + 'docker manifest push grafana/loki-canary:latest', + 'docker manifest create grafana/loki-canary:v2 grafana/loki-canary:v2-amd64 grafana/loki-canary:v2-arm grafana/loki-canary:v2-arm64', + 'docker manifest push grafana/loki-canary:v2', + 'docker manifest create grafana/loki-canary:v2.9 grafana/loki-canary:v2.9-amd64 grafana/loki-canary:v2.9-arm grafana/loki-canary:v2.9-arm64', + 'docker manifest push grafana/loki-canary:v2.9' ]) }) diff --git a/actions/push-images/dist/index.js b/actions/push-images/dist/index.js index b13accbc..0b335ed8 100644 --- a/actions/push-images/dist/index.js +++ b/actions/push-images/dist/index.js @@ -24973,7 +24973,11 @@ function buildDockerPluginCommands(repo, buildDir, imageDir, files, isLatest) { commands.push(`docker plugin push "${repo}/${image}:${version.toString()}-${shortPlatform}"`); // Add latest tag for each platform if this is the latest version if (isLatest) { - commands.push(`docker plugin create ${repo}/${image}:latest-${shortPlatform} "${buildDir}"`, `docker plugin push "${repo}/${image}:latest-${shortPlatform}"`); + commands.push(`docker plugin create ${repo}/${image}:latest-${shortPlatform} "${buildDir}"`, `docker plugin push "${repo}/${image}:latest-${shortPlatform}"`, + // Add major version tag (e.g., v2-amd64) + `docker plugin create ${repo}/${image}:v${version.major}-${shortPlatform} "${buildDir}"`, `docker plugin push "${repo}/${image}:v${version.major}-${shortPlatform}"`, + // Add major.minor version tag (e.g., v2.9-amd64) + `docker plugin create ${repo}/${image}:v${version.major}.${version.minor}-${shortPlatform} "${buildDir}"`, `docker plugin push "${repo}/${image}:v${version.major}.${version.minor}-${shortPlatform}"`); } } } @@ -25016,14 +25020,20 @@ function buildCommands(repo, imageDir, files, isLatest) { manifests.push(`${repo}/${image}:${version.toString()}-${shortPlatform}`); // Add latest tag for each platform if this is the latest version if (isLatest) { - commands.push(`docker tag ${repo}/${image}:${version.toString()}-${shortPlatform} ${repo}/${image}:latest-${shortPlatform}`, `docker push ${repo}/${image}:latest-${shortPlatform}`); + commands.push(`docker tag ${repo}/${image}:${version.toString()}-${shortPlatform} ${repo}/${image}:latest-${shortPlatform}`, `docker push ${repo}/${image}:latest-${shortPlatform}`, + // Add major version tag (e.g., v2-amd64) + `docker tag ${repo}/${image}:${version.toString()}-${shortPlatform} ${repo}/${image}:v${version.major}-${shortPlatform}`, `docker push ${repo}/${image}:v${version.major}-${shortPlatform}`, + // Add major.minor version tag (e.g., v2.9-amd64) + `docker tag ${repo}/${image}:${version.toString()}-${shortPlatform} ${repo}/${image}:v${version.major}.${version.minor}-${shortPlatform}`, `docker push ${repo}/${image}:v${version.major}.${version.minor}-${shortPlatform}`); } } commands.push(`docker push -a ${repo}/${image}`, `docker manifest create ${repo}/${image}:${version.toString()} ${manifests.join(' ')}`, `docker manifest push ${repo}/${image}:${version.toString()}`); // Create and push latest manifest if this is the latest version if (isLatest) { const latestManifests = manifests.map(m => m.replace(`:${version.toString()}-`, ':latest-')); - commands.push(`docker manifest create ${repo}/${image}:latest ${latestManifests.join(' ')}`, `docker manifest push ${repo}/${image}:latest`); + const majorManifests = manifests.map(m => m.replace(`:${version.toString()}-`, `:v${version.major}-`)); + const majorMinorManifests = manifests.map(m => m.replace(`:${version.toString()}-`, `:v${version.major}.${version.minor}-`)); + commands.push(`docker manifest create ${repo}/${image}:latest ${latestManifests.join(' ')}`, `docker manifest push ${repo}/${image}:latest`, `docker manifest create ${repo}/${image}:v${version.major} ${majorManifests.join(' ')}`, `docker manifest push ${repo}/${image}:v${version.major}`, `docker manifest create ${repo}/${image}:v${version.major}.${version.minor} ${majorMinorManifests.join(' ')}`, `docker manifest push ${repo}/${image}:v${version.major}.${version.minor}`); } } return commands; diff --git a/actions/push-images/src/docker.ts b/actions/push-images/src/docker.ts index 32c03a4f..b7c2f942 100644 --- a/actions/push-images/src/docker.ts +++ b/actions/push-images/src/docker.ts @@ -59,7 +59,13 @@ export function buildDockerPluginCommands( if (isLatest) { commands.push( `docker plugin create ${repo}/${image}:latest-${shortPlatform} "${buildDir}"`, - `docker plugin push "${repo}/${image}:latest-${shortPlatform}"` + `docker plugin push "${repo}/${image}:latest-${shortPlatform}"`, + // Add major version tag (e.g., v2-amd64) + `docker plugin create ${repo}/${image}:v${version.major}-${shortPlatform} "${buildDir}"`, + `docker plugin push "${repo}/${image}:v${version.major}-${shortPlatform}"`, + // Add major.minor version tag (e.g., v2.9-amd64) + `docker plugin create ${repo}/${image}:v${version.major}.${version.minor}-${shortPlatform} "${buildDir}"`, + `docker plugin push "${repo}/${image}:v${version.major}.${version.minor}-${shortPlatform}"` ) } } @@ -115,7 +121,13 @@ export function buildCommands( if (isLatest) { commands.push( `docker tag ${repo}/${image}:${version.toString()}-${shortPlatform} ${repo}/${image}:latest-${shortPlatform}`, - `docker push ${repo}/${image}:latest-${shortPlatform}` + `docker push ${repo}/${image}:latest-${shortPlatform}`, + // Add major version tag (e.g., v2-amd64) + `docker tag ${repo}/${image}:${version.toString()}-${shortPlatform} ${repo}/${image}:v${version.major}-${shortPlatform}`, + `docker push ${repo}/${image}:v${version.major}-${shortPlatform}`, + // Add major.minor version tag (e.g., v2.9-amd64) + `docker tag ${repo}/${image}:${version.toString()}-${shortPlatform} ${repo}/${image}:v${version.major}.${version.minor}-${shortPlatform}`, + `docker push ${repo}/${image}:v${version.major}.${version.minor}-${shortPlatform}` ) } } @@ -131,9 +143,22 @@ export function buildCommands( const latestManifests = manifests.map(m => m.replace(`:${version.toString()}-`, ':latest-') ) + const majorManifests = manifests.map(m => + m.replace(`:${version.toString()}-`, `:v${version.major}-`) + ) + const majorMinorManifests = manifests.map(m => + m.replace( + `:${version.toString()}-`, + `:v${version.major}.${version.minor}-` + ) + ) commands.push( `docker manifest create ${repo}/${image}:latest ${latestManifests.join(' ')}`, - `docker manifest push ${repo}/${image}:latest` + `docker manifest push ${repo}/${image}:latest`, + `docker manifest create ${repo}/${image}:v${version.major} ${majorManifests.join(' ')}`, + `docker manifest push ${repo}/${image}:v${version.major}`, + `docker manifest create ${repo}/${image}:v${version.major}.${version.minor} ${majorMinorManifests.join(' ')}`, + `docker manifest push ${repo}/${image}:v${version.major}.${version.minor}` ) } }