-
Notifications
You must be signed in to change notification settings - Fork 1
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(plugin): Add ability to push multiple docker images #7
base: master
Are you sure you want to change the base?
feat(plugin): Add ability to push multiple docker images #7
Conversation
This feature allows specifying the plugin multiple times in order to push multiple images to a docker repository. iteratec#4
I don't know why but the tests in the |
Hi @DanielHabenicht, with this PR you'd basically revert my changes to mock/stub the docker dependency during unit tests. I've added more test as examples for how I'd like to proceed. Please review these and update your PR. |
Ahh, ok. I think I misunderstood. I will include your changes as units tests and add my tests as e2e Tests. |
I actually meant for you to refactor your tests to use sinon for mocking/stubbing, so that testruns are no longer depending on docker being available on build/test agents. An added benefit is that testruns take a LOT less time, eg currently down to 85ms per test run opposed to 1 – 3s per testcase.
…Sent from my Windows 10 device
________________________________
From: DanielHabenicht <[email protected]>
Sent: Wednesday, May 1, 2019 12:53:16 PM
To: iteratec/semantic-release-docker
Cc: Christoph Murczek; Comment
Subject: Re: [iteratec/semantic-release-docker] feat(plugin): Add ability to push multiple docker images (#7)
Ahh, ok. I think I misunderstood. I will include your changes as units tests and add my tests as e2e Tests.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#7 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AGDFOJM2DR27PW535IG7CGTPTFZBZANCNFSM4HI2VTQQ>.
|
- delete unused auth.ts file - remove docker dependent code in spec files
tests for registry url readded
Finally, I had some time to refactor the code. I take your point on running the tests a lot faster for development, that's why I refactored it. Have a look and feel free to comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do get your motivation for bringing in e2e tests, but this way they provide no benefit over good unit tests. The do however cost time, especially when they are part of every build.
If we added e2e tests they should be truly e2e, meaning actually using semantic-realease with this plugin to build a docker image. However, for now at least I don't see the need for that.
I do like the original idea of the PR though. I'm not sure if the way it's implemented is the best strategy. What's your take on something like
{ plugins: [ prepare: [{ path: "@iteratec/semantic-release-docker", images: [{ additionalTags: [], imageName: "", registryUrl: "", repositoryName: "", }] }] }
To me it feels more natural to configure the plugin once, and have it deal with multiple images, instead of loading multiple instances of the same plugin...
src/verifyConditions/index.spec.ts
Outdated
expect(dockerStub.checkAuth.firstCall.args[0]).to.deep.equal(expected); | ||
}); | ||
|
||
it('should default to docker hub if no registry is specified', async function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would you remove this test? I want to make sure we let docker decide which registry to use if none is specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it basically is a duplicate of "should use the registry from the config" the test checks if the string put into the config is returned. The main difference is that one string is ''
and the other is 'my_private_registry'
"commit": "git-cz", | ||
"test": "mocha -r chai -r chai-as-promised -r ts-node/register src/**/*.spec.ts", | ||
"e2e": "mocha -r chai -r chai-as-promised -r ts-node/register src/**/*.e2e.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this script
inputs: | ||
verbose: false | ||
- task: Npm@1 | ||
displayName: Build | ||
inputs: | ||
command: custom | ||
customCommand: run build | ||
- task: Npm@1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this task
@@ -0,0 +1,2 @@ | |||
FROM scratch | |||
ARG TEST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't burden yourself with creating actual images while developing this plugin. There is no benefit over (correctly) mocking/stubbing dockerode.
There are numerous reasons and benefits for the e2e tests:
If you think the build time is too long I can make them run in parallel. But I think that waiting 22 seconds are worth the amount of time needed for others to test, verify, file a bug and resolve the issue coming from not testing it.
I think of these as integration tests, that's also a good idea but I do align with your view.
I think the way it is implemented is the way to go, with the option to specify multiple images you are bringing in another way of using the plugin, while not fixing the way it already can be used. |
- also remove unecessary if condition
@cmurczek any updates? |
This feature allows specifying the plugin multiple times in order to push multiple images to a
docker repository.
#4