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

Compare tar ball checksum to allow tomcat upgrades #47

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

cdm-arm
Copy link
Contributor

@cdm-arm cdm-arm commented Dec 14, 2021


name: Pull request
about: This is related to #22 and allows the tomcat role to verify if a newer version was downloaded and upgrade the instance.


Describe the change
Calculate the sha1 of the tomcat tarball and verify it with the sha1 of the freshly downloaded tarball. If there is a difference the instance bin folder gets removed to trigger the extracting of the new tarball

Testing
Manually tested playbook with:

  • Fresh install - Tomcat installed ✅
  • Re-run against same tomcat version - No change performed ✅
  • Re-Run with newer tomcat version - Upgrade installed ✅
  • Re-Run with older tomcat version - Downgraded version installed ✅

@robertdebock
Copy link
Owner

Looks like a good addition, but; it's not idempotent. I guess this tasks is the issue.

@cdm-arm
Copy link
Contributor Author

cdm-arm commented Dec 16, 2021

Good intention, bad implementation. I changed the way, now utilising the sha512 hashes that Apache anyhow provides.

@OyvindLGjesdal
Copy link

OyvindLGjesdal commented Nov 28, 2022

Very nice feature @aek-arm and exactly what I was looking for, thanks for posting :)

I think this may pass the CI-actions if the sections with {{ tomcat_directory }}/ is changed to {{ tomcat_directory }}/{{ instance.name }}

I ran a local version with

 - name: stop instance for upgrade
      service:
        name: "{{ instance.name }}"
        state: stopped
      when: slurped_sha512hash.content is defined

at the beginning of the block to avoid any issues with removing stuff during running and checksum for the url seem to fail for older ansible versions, so I use

   checksum: "sha512:{{ tomcat_download_sha512 | regex_replace('\\s[*].+$','') }}}}"

instead.

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.

4 participants