In prior months, figuring out "what changed" was left as a manual step for the team-member charged with running the automation for a given month's publication event. This month, no one generated that news article and there were several updated and new RPMs included in the new image. So, I set about figuring out "how to extract this information programmatically so as to more-easily suss-out what to include in the announcement posting." The following does so (though, presumably, in a not-particularly-optimized) fashion:
To explain:git diff $( git log --pretty='%H' --follow -- <PATH_TO_MANIFEST_FILE> | \ head -2 | \ tac | \ sed 'N;s/\n/../' ) -- <PATH_TO_MANIFEST_FILE> | \ grep -E '(amazon|aws|ec2)-' | \ sed 's/^./& /' | \ sort -k 2
- Use `git log` to output the commit-hashes for all the commits for the target file (in this case, the project's manifest-file)
- Use `head -2` to grab only the two most-recent commit hashes from the output-stream
- Use the `tac` command to invert the order of the two lines returned from the `head` command
- Use the `sed` command to join the two lines, replacing the first line's line-ending newline character with ".."
- Use `git diff` against the output created in steps 1-4, and constrain the diff-activity to just the manifest-file.
- Pipe that output through `grep` to suppress all information other than the bits containing the `amazon-`, `aws-` and `ec2-` substrings.
- Pipe that through `sed` so that the +/- that `git diff` uses to show new and removed files, respectively, becomes an easily-tokenized substring.
- Sort the remaining output-stream (with `sort`) so that the lines are groups by manifest-element (the second key/token in the sorted output)
Taking that output and converting to a news article is still manual, but it at least makes it a lot easier to do than either hand-diffing two files or having to "just know" what's changed.
Because Red Hat has placed EL6 is in its final stage of de-support, we've stopped publishing CentOS6 and RHEL6. We did this to discourage our subscribers from doing new deployments on EL6 (since the underlying platform will go into final de-support come November of this year).
Similarly, due to current lack of CentOS offering for EL8, lack of security-related build- or hardening-guidance for EL8 and associated lack of subscriber-demand for an EL8 build, we don't yet include builds for CentOS8 or RHEL8 in our process. Thus, for the time being, we only need to provide a "whats changed" for EL7 builds. Given this, we currently only need to do change-queries against the "manifests/spel-minimal-centos-7-hvm.manifest.txt" file.
No comments:
Post a Comment