-
Notifications
You must be signed in to change notification settings - Fork 2
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
[FEATURE] Implement concept for artifact migration #138
Conversation
Code Climate has analyzed commit 62a739a and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 99.6% (50% is the threshold). This pull request will bring the total coverage in the repository to 96.5% (0.2% change). View more on Code Climate. |
Codecov Report
@@ Coverage Diff @@
## 3.x #138 +/- ##
============================================
+ Coverage 97.66% 98.21% +0.54%
- Complexity 692 774 +82
============================================
Files 101 111 +10
Lines 2186 2461 +275
============================================
+ Hits 2135 2417 +282
+ Misses 51 44 -7
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
cd270ab
to
8589ad5
Compare
c07aa8a
to
eb5bd75
Compare
Oh boy. |
dcf3450
to
9f9e7a0
Compare
This implementation is similar to the one of Doctrine migrations.
🚨 The following issue needs to be resolved first in order to get this merged:
⬆️ This error occurs at the end when dumping the artifact. It happens because the schema file is no longer available due to the previous file mirroring. |
Done ✅ |
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.
OMG. I literally cannot wait to see this in action. 🌸
This PR implements aims to integrate a migration concept for versioned build artifacts.
Note
As this is an internal component, it currently does not need to be documented. However, once the relevant components for project migration (see #85) are implemented, we should add a small chapter explaining what is happening internally.
In this PR, three new components are added:
Builder\ArtifactGenerator
now takes care of artifact generation. The artifacts available atBuilder\Artifact
were rewritten to exclude every business-logic, making them easily restorable when it comes to artifact reconstitution. That said, the main artifact is no longerBuilder\Artifact\BuildArtifact
, butBuilder\Artifact\Artifact
which contains all sub-artifacts, includingBuilder\Artifact\BuilderArtifact
and friends. In addition, theBuilder\BuildResult
does no longer store a prepared artifact. Instead, it holds a reference to the artifact file being generated later. For this, two new methodsBuilder\BuildResult::setArtifactFile()
andBuilder\BuildResult::getArtifactFile()
were added.Builder\Artifact\Migration\Migration
provides an interface for concrete artifact migrations. A class implementing this interface should provide the source artifact version, target artifact version and the concrete migration implementation. In addition, aBuilder\Artifact\Migration\BaseMigration
class is added which contains basic methods for usual artifact migrations.Builder\ArtifactReader
is a brand-new component that is added next to the version component. It reads an artifact from a given file, migrates it to the current version using all registered migrations and maps the migrated artifact to an instance ofBuilder\Artifact\Artifact
. This way, it is possible to restore a dumped artifact and reuse it, e.g. when implementing project synchronization as requested in [FEATURE] Sync existing projects #85.💡 In addition to the new components, a silent migration for all v1 artifacts is added: The
artifact.file
path is silently migrated toartifact.path
withinBuilder\Artifact\Migration\Migration1679497137
. That's because this path was wrong implemented in the first place and differed from the configured property in the build artifact JSON schema.Resolves: #117