Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow using non-slim renovate image #626

Merged
merged 7 commits into from
Jan 23, 2023
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
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ inputs:
configured using a Secret. Either use this input or the 'RENOVATE_TOKEN'
environment variable.
required: false
useSlim:
description: |
Use a lightweight renovate container without any third-party binaries.
Defaults to true if not set.
required: false
runs:
using: node16
main: dist/index.js
11 changes: 9 additions & 2 deletions src/docker.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import type { Input } from './input';

class Docker {
readonly repository = 'renovate/renovate';
// renovate: datasource=docker depName=renovate/renovate versioning=docker
readonly tag = '34.109.1-slim';
readonly tagSuffix = '-slim';
readonly fullTag: string;

constructor(private input: Input) {
this.fullTag = input.useSlim() ? this.tag : this.tag.replace(this.tagSuffix, '');
}

image(): string {
return `${this.repository}:${this.tag}`;
return `${this.repository}:${this.fullTag}`;
}

version(): string {
viceice marked this conversation as resolved.
Show resolved Hide resolved
return this.tag.replace(this.tagSuffix, '');
return this.fullTag;
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/get-version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as core from '@actions/core';
import Docker from './docker';
import { Input } from './input';

const docker = new Docker();
const input = new Input();
const docker = new Docker(input);
core.setOutput('version', docker.version());
4 changes: 4 additions & 0 deletions src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class Input {
return null;
}

useSlim(): boolean {
return core.getInput(`useSlim`) !== 'false';
}

/**
* Convert to environment variables.
*
Expand Down
2 changes: 1 addition & 1 deletion src/renovate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Renovate {
constructor(private input: Input) {
this.validateArguments();

this.docker = new Docker();
this.docker = new Docker(input);
}

async runDockerContainer(): Promise<void> {
Expand Down