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

version is missing from previous step #31

Closed
robertskworld opened this issue Feb 16, 2024 · 7 comments
Closed

version is missing from previous step #31

robertskworld opened this issue Feb 16, 2024 · 7 comments

Comments

@robertskworld
Copy link

Hello

I have the latest version of concourse deployed on a Kubernetes cluster without persistence.
(K8s Image: concourse/concourse:7.11.2)
I want to deploy the pipeline via your ansible resource type, through this yaml, with fly:

fly set-pipeline /target test /pipeline ansible-playbook2 /config ./pipeline-ansible2.yaml


resource_types:

  • name: ansible
    type: docker-image
    source:
    repository: troykinsella/concourse-ansible-playbook-resource

resources:

  • name: ansible
    type: ansible
    source:
    verbose: v

jobs:

  • name: ansible-playbook
    plan:
    • get: ansible

fly deployment + resource type check - will be always successful.
But when I check the resource - I always get this error:

fly check-resource /target test /resource:ansible-playbook2/ansible
checking ansible-playbook2/ansible in build 4381
initializing check: ansible
initializing check: ansible
selected worker: concourse-worker-1
version is missing from previous step
version is missing from previous step
errored

I tried setting all possible combinations for version & tag key in source type and source too - no luck.
In your ansible playbook container, I can see that the container is really trying to output the version information:

ansible-test:/opt/resource# ls -all
total 24
drwxr-xr-x 3 root root 4096 Jan 17 18:42 .
drwxr-xr-x 1 root root 4096 Jan 17 18:42 ..
-rwxr-xr-x 1 root root 20 Jul 3 2023 check
-rwxr-xr-x 1 root root 34 Jul 3 2023 in
drwxrwxr-x 3 root root 4096 Nov 20 19:49 lib
-rwxr-xr-x 1 root root 276 Jul 3 2023 out
ansible-test:/opt/resource# cat in
#!/bin/sh
printf '{"version":{}}'
ansible-test:/opt/resource#

When I try another ansible resource type clone (e.g. - argon/concourse-ansible-playbook-resource) - everything works immediately.
This link also solves something similar - concourse/registry-image-resource#316 - but it didn't help me either.

Pls, where and how should I set it so that the resource type check will be successful?

@troykinsella
Copy link
Owner

Hi there! This resource is put-only, so a get, regardless of this error, would be a no-op.
If you have a playbook that you're trying to run from a pipeline, you can pull in a git resource, for example, and then invoke it via a put:

- name: run-my-playbook
  steps:
  - get: master # your git repo
  - put: ansible
    params:
      check: true
      diff: true
      inventory: inventory/some-hosts.yml
      playbook: site.yml
      path: master

Hope that helps. Let me know if you had something else in mind.

@robertskworld
Copy link
Author

Thank you very much for your answer.
I would like to draw attention to the fact that my problem is not in the implementation of put/get via the job - but in the initialization check of the resource type itself, which is done before the implementation/build, as seen in the printscreen.

So for clarity:

  • I also tried it with the put option - the same result
  • here is my procedure, with the described result:

-> cat pipeline-ansible.yaml
_concourse ansible_playbook pipeline

-> fly destroy-pipeline /target ace-test /p deploy-ansible-playbook
!!! this will remove all data for pipeline deploy-ansible-playbook

are you sure? [yN]: y
deploy-ansible-playbook does not exist

-> fly set-pipeline /target ace-test /pipeline deploy-ansible-playbook /config ./pipeline-ansible.yaml
resources:
resource ansible has been added:

  • icon: ansible

  • name: ansible

  • source:

  • debug: true

  • verbose: vv

  • type: ansible

    resource git has been added:

  • icon: github

  • name: git

  • source:

  • branch: master

  • password: ((git-acecloud-interny.gitpswd))

  • skip_ssl_verification: true

  • uri: https://gitlab/........./linux-playbooks

  • username: ((git-acecloud-interny.gituser))

  • type: git

resource types:
resource type ansible has been added:

  • name: ansible
  • source:
  • repository: troykinsella/concourse-ansible-playbook-resource
  • tag: latest
  • type: docker-image

jobs:
job deploy-ansible-playbook has been added:

  • name: deploy-ansible-playbook
  • plan:
    • get: git
    • params:
  • inventory: _play.lin.node_exporter/inventory/hosts
    
  • path: git
    
  • playbook: _play.lin.node_exporter/_ansible_playbook.linux.prometheus.yml
    
  • put: ansible

pipeline name: deploy-ansible-playbook

apply configuration? [yN]: y
pipeline created!
you can view your pipeline here: https://concourse............../pipelines/deploy-ansible-playbook

the pipeline is currently paused. to unpause, either:

  • run the unpause-pipeline command:
    C:\sklad\concourse_cli\fly.exe -t ace-test unpause-pipeline -p deploy-ansible-playbook
  • click play next to the pipeline in the web ui

_concourse ansible_playbook implementation

@troykinsella
Copy link
Owner

Do you have a private Docker registry in place, perhaps? If so, are you able to delete the latest tag and re-pull? Can you fetch the image directly from a Concourse worker?

What happens when you fly check-resource-type --resource-type deploy-ansible-playbook/ansible?

How about a fly clear-versions?

Sorry if these suggestions are obvious. I've not encountered this error before.

@robertskworld
Copy link
Author

Hello,

I had to change the pipeline a bit, but the result is the same.
I don't use any private repo, I call DockerHub directly.
As I wrote, the error is reported by the resource and not the resource type check.
I increased the debug level, but from the monitoring results - I don't see anything new.
Just checking the source gives me an error, but I can't tell if it's a reason.
I could not find out how to fetch the image from the worker node, if you advise, I will do it. But I have a feeling that it will only happen when the resource's init check passes.

FYI - fly CLI is on windows
fly --version
7.11.2

_concourse ansible pipeline
_concourse ansible pipeline outputs

@robertskworld
Copy link
Author

Hello,

FYI:
when I use the version 2.2.2 of your source type - everything works, is OK.
So the problem will be around the changes of the last version.

One more question please:
Is it possible to change the version of ansible, or is it always static according to the version of resource type?

@troykinsella
Copy link
Owner

troykinsella commented Mar 1, 2024

I've rebuilt the image and pushed a fresh latest tag. Can you please check if the issue is resolved?

You could probably install a specific version of Ansible upon every job run, as per this explanation for additional modules: https://github.com/troykinsella/concourse-ansible-playbook-resource?tab=readme-ov-file#custom-setup-commands
But, the overhead of doing so might be undesirable, and if so, I think you're looking at extending this image and installing the things that you require.

@robertskworld
Copy link
Author

robertskworld commented Mar 4, 2024 via email

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

No branches or pull requests

2 participants