Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ non-idempotent targets, not for the Docker target.
| `source` | Path to the source Docker image to be pulled |
| `sourceFormat` | Format for the source image name. Default: `{{source}}:{{revision}}` |
| `target` | Path to the target Docker image to be pushed |
| `targetFormat` | Format for the target image name. Default: `{{target}}:{{release}}` |
| `targetFormat` | Format for the target image name. Default: `{{target}}:{{version}}` |

**Example**

Expand Down
10 changes: 5 additions & 5 deletions src/targets/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface DockerTargetOptions extends TargetConfig {
source: string;
/** Full name template for the source image path, defaults to `{{source}}:{{revision}}` */
sourceTemplate: string;
/** Full name template for the target image path, defaults to `{{target}}:{{release}}` */
/** Full name template for the target image path, defaults to `{{target}}:{{version}}` */
targetTemplate: string;
/** Target image path, like `getsentry/craft` */
target: string;
Expand Down Expand Up @@ -66,7 +66,7 @@ export class DockerTarget extends BaseTarget {
source: this.config.source,
target: this.config.target,
sourceTemplate: this.config.sourceFormat || '{{source}}:{{revision}}',
targetTemplate: this.config.targetFormat || '{{target}}:{{release}}',
targetTemplate: this.config.targetFormat || '{{target}}:{{version}}',
username: process.env.DOCKER_USERNAME,
};
}
Expand Down Expand Up @@ -106,16 +106,16 @@ export class DockerTarget extends BaseTarget {
/**
* Pushes the locally tagged source image to Docker Hub
* @param sourceRevision The tag/revision for the source image
* @param targetTag The target tag (release version) for the target image
* @param version The release version for the target image
*/
public async push(sourceRevision: string, targetTag: string): Promise<any> {
public async push(sourceRevision: string, version: string): Promise<any> {
const sourceImage = renderTemplateSafe(this.dockerConfig.sourceTemplate, {
...this.dockerConfig,
revision: sourceRevision,
});
const targetImage = renderTemplateSafe(this.dockerConfig.targetTemplate, {
...this.dockerConfig,
release: targetTag,
version,
});
logger.debug('Tagging target image...');
await spawnProcess(DOCKER_BIN, ['tag', sourceImage, targetImage]);
Expand Down