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

artifactory.product.version.properties is not existing in older builds so upgrades fail. #372

Open
darthVikes opened this issue Feb 7, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@darthVikes
Copy link

[root@server jfrog]# pwd
/opt/jfrog
[root@server jfrog]# ll
total 2043884
drwxr-xr-x. 4 artifactory artifactory 157 Feb 2 16:50 artifactory
drwxr-xr-x 4 artifactory artifactory 28 May 21 2021 artifactory-pro-7.19.4
drwxr-xr-x 4 artifactory artifactory 28 Jan 23 15:44 artifactory-pro-7.77.3
-rw-r--r-- 1 artifactory artifactory 497144409 Feb 1 15:31 jfrog-artifactory-pro-7.19.4-linux.tar.gz
-rw-r--r-- 1 artifactory artifactory 1595786359 Feb 6 13:45 jfrog-artifactory-pro-7.77.3-linux.tar.gz

  • name: Copy untar directory to artifactory home
    become: true
    ansible.builtin.copy:
    src: "{{ artifactory_untar_home }}/"
    dest: "{{ artifactory_home }}"
    owner: "{{ artifactory_user }}"
    group: "{{ artifactory_group }}"
    mode: 0755
    remote_src: true
    when: not app_dir_check.stat.exists

and there are folders/files in there:

cd /opt/jfrog/artifactory/app
[root@server app]# ll
total 4
drwxr-xr-x 3 artifactory artifactory 20 May 21 2021 artifactory
drwxr-xr-x 3 artifactory artifactory 4096 Feb 2 16:37 bin
drwxr-xr-x 2 artifactory artifactory 225 Feb 1 15:32 doc
drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 event
drwxr-xr-x 3 artifactory artifactory 17 Feb 2 21:46 frontend
drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 metadata
drwxr-xr-x 6 artifactory artifactory 95 Feb 1 15:31 misc
drwxr-xr-x 4 artifactory artifactory 28 May 21 2021 replicator
drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 router
drwxr-xr-x 2 artifactory artifactory 6 Feb 6 13:46 run
drwxr-xr-x 8 artifactory artifactory 88 May 21 2021 third-party

This file was not copied; artifactory.product.version.properties

Present in newer builds:

/opt/jfrog/artifactory-pro-7.77.3/app
[root@server app]# ll
total 12
drwxr-xr-x 3 artifactory artifactory 20 Jan 23 15:44 artifactory
-rwxr-xr-x 1 artifactory artifactory 174 Jan 23 15:18 artifactory.product.version.properties
drwxr-xr-x 3 artifactory artifactory 4096 Feb 6 13:46 bin
drwxr-xr-x 2 artifactory artifactory 4096 Feb 6 13:46 doc
drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:44 event
drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:44 frontend
drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:21 jfconnect
drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:44 metadata
drwxr-xr-x 6 artifactory artifactory 95 Feb 6 13:46 misc
drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:44 observability
drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:21 replicator
drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:44 router
drwxr-xr-x 4 artifactory artifactory 28 Jan 23 15:44 rtfs
drwxr-xr-x 8 artifactory artifactory 88 Jan 23 15:44 third-party

artifactory.product.version.properties not present in older builds.

[root@server app]# pwd
/opt/jfrog/artifactory-pro-7.19.4/app
[root@server app]# ls -al
total 4
drwxr-xr-x 12 artifactory artifactory 155 Feb 1 15:32 .
drwxr-xr-x 4 artifactory artifactory 28 May 21 2021 ..
drwxr-xr-x 3 artifactory artifactory 20 May 21 2021 artifactory
drwxr-xr-x 3 artifactory artifactory 4096 Feb 1 15:31 bin
drwxr-xr-x 2 artifactory artifactory 225 Feb 1 15:32 doc
drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 event
drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 frontend
drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 metadata
drwxr-xr-x 6 artifactory artifactory 95 Feb 1 15:31 misc
drwxr-xr-x 4 artifactory artifactory 28 May 21 2021 replicator
drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 router
drwxr-xr-x 8 artifactory artifactory 88 May 21 2021 third-party

Originally posted by @darthVikes in #365 (comment)

@darthVikes
Copy link
Author

Seems like a lot of work to go back to every previous release to make sure that file is there. A quicker option is if that file is not there perhaps look for the installer-info.json file that was created with older versions.

I was able to work around the issue by copying the artifactory.product.version.properties file from the newer build and then editing it to contain the older version information.

@chukka chukka added the bug Something isn't working label Feb 8, 2024
@kammathavaran
Copy link

We are acknowledging this issue. We will plan for a viable solution and update this thread at a later time.

@meiswjn
Copy link

meiswjn commented Mar 4, 2024

We have the same issue in Ansible:

13:21:18  TASK [jfrog.platform.artifactory : Ensure jfrog_home_directory exists] *********
13:21:18  ok: [x01134745]
13:21:18  [WARNING]: Unable to find '/tmp/artifactory.product.version.properties' in
13:21:18  expected paths (use -vvvvv to see paths)
13:21:18  
13:21:18  TASK [jfrog.platform.artifactory : Set running_version] ************************
13:21:18  fatal: [x01134745]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'ansible.builtin.ini'. Error was a <class 'ansible.errors.AnsibleParserError'>, original message: Invalid filename: 'None'. Invalid filename: 'None'"}

If this was introduced by #369, it should be marked as a breaking change. Also, can you please provide a more detailed workaround or can the issue itself be fixed?

@Logeshwarsn
Copy link
Contributor

@meiswjn From the above log ,we can see it is fetching from /tmp/artifactory.product.version.properties not from artifactory_home ? Could you please provide us more information on this ? How are you running this ansible playbook. And from which version of artifactory are you trying to upgrade ?

@meiswjn
Copy link

meiswjn commented Mar 25, 2024

Hello,

Yes, I think the fetching itself is only done indirectly on the artifactory_home with the copy task. The actual task works on /tmp:

running_version: "{{ lookup('ansible.builtin.ini', 'artifactory.product.version', type='properties', file='/tmp/artifactory.product.version.properties') }}"

Our workaround was using version 10.17.0 of this ansible module. We actually didn't upgrade Artifactory at all - I think it just checked whether an update is needed. Our current version is 7.77.5

@meiswjn
Copy link

meiswjn commented Jul 9, 2024

Hello,

Any news on this issue?

Thanks,
Jan

@darthVikes
Copy link
Author

I recently tried to upgrade again today and this is still not fixed in the latest version aka v10.19.5, so the upgrades are still broken.

TASK [jfrog.platform.artifactory : Check artifactory version] **********************************
task path: /opt/repo/provisioning/collections/ansible_collections/jfrog/platform/roles/artifactory/tasks/upgrade.yml:59
fatal: [artifactoryhost]: FAILED! => {"changed": false, "msg": "the remote file does not exist, not transferring, ignored"}

The above task is failing on :

  • name: Check artifactory version
    ansible.builtin.fetch:
    src: "{{ artifactory_home }}/app/artifactory.product.version.properties"
    dest: "/tmp/artifactory.product.version.properties"
    flat: true
    changed_when: false

There is no artifactory.product.version.properties in our current version of artifactory. aka 7.19.4

Trying to see if I can copy a file there from the new version and modify its properties to our current version, but trying to find the info but for 7.19.4

Can someone advise where to get the info for the bottom two variables?

artifactory.product.version=7.19.4
artifactory.product.revision=71904900
artifactory.product.timestamp=
artifactory.product.buildNumber=

Can this be added to the documentation as a known issue at least, and where to get the information to create this file pre-upgrade?

Or maybe find a way to create this file based on their current version before it tries to upgrade?

Thanks!

@darthVikes
Copy link
Author

darthVikes commented Oct 3, 2024

So seems like

https://github.com/jfrog/JFrog-Cloud-Installers/blob/3cd3a26e3384ae2313601ac906638d6bacf64a77/Ansible/ansible_collections/jfrog/platform/roles/artifactory/tasks/upgrade.yml#L59-


- name: Check artifactory version
  ansible.builtin.fetch:
    src: "{{ artifactory_home }}/app/artifactory.product.version.properties"
    dest: "/tmp/artifactory.product.version.properties"
    flat: true
  changed_when: false

- name: Set running_version
  ansible.builtin.set_fact:
    running_version: "{{ lookup('ansible.builtin.ini', 'artifactory.product.version', type='properties', file='/tmp/artifactory.product.version.properties') }}"

could be changed to ;

   - name: Check artifactory version
      ansible.builtin.uri:
        url: https://localhost/artifactory/api/system/version
        method: GET
        validate_certs: false
        return_content: true
      register: result

   - name: Set running_version
      ansible.builtin.set_fact:
        running_version: result.json.version

Although, the above needs to be done in a spot where the web server/app is still running, another option is to create the file in /tmp/artifactory.product.version.properties from the web api query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants