Skip to content

Comments

feat: allow templating of registry and name#56

Open
eliotstocker wants to merge 1 commit intoesatterwhite:mainfrom
Attest:allow-templating-registry-and-name
Open

feat: allow templating of registry and name#56
eliotstocker wants to merge 1 commit intoesatterwhite:mainfrom
Attest:allow-templating-registry-and-name

Conversation

@eliotstocker
Copy link

I have a use case that requires templating on name and registry, hopefully the code is very self explainitory 😄

Copy link
Owner

@esatterwhite esatterwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit picky thing, otherwise this seems good to me

Comment on lines +81 to +87
registry
, project: opts.project
, name: opts.name
, name
, dockerfile: opts.dockerfile
, build_id: opts.build
, cwd: context.cwd
, tags: tags
, tags
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would you mind keeping the longhand style consistent? name: name

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding something in the tests that illustrates that this works?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 sure thing ill get on it as soon as i have a moment!

@esatterwhite
Copy link
Owner

Out of curiosity, whats the use case?

@eliotstocker
Copy link
Author

using it inside of a preset, so passing the image name as an env var makes things much easier 😄

@esatterwhite
Copy link
Owner

esatterwhite commented Aug 15, 2024

using it inside of a preset, so passing the image name as an env var makes things much easier 😄

Isn't the preset config a JS module? couldn't you just pull in what ever variables need to be in there?

module.exports = {
  branches: ['main']
  plugins: [
    ['@codedependant/semantic-release-docker', {
      dockerTags: ['latest', '{{version}}', '{{major}}-latest', '{{major}}.{{minor}}'],
      dockerFile: 'Dockerfile',
      dockerImage: process.env.DOCKER_IMAGE_NAME,
      dockerRegistry: process.env.DOCKER_REGISTRY,
      dockerProject: process.env.DOCKER_PROJECT,
    }]
  ]
}

Or 1 variable that you parse out the bits.

I'm not saying what you have here is a bad thing. It just starts to create some sprawl as to where variables are resolved. And it may be solvable with what currently exists.

You can tell me I am wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants