drupal-operator icon indicating copy to clipboard operation
drupal-operator copied to clipboard

Example Drupal definition results in failure due to undefined 'git' variable

Open geerlingguy opened this issue 6 years ago • 2 comments

When I install this operator in my local cluster using the updated directions in #3, the Drupal instance example-drupal never gets created; instead, the operator keeps trying to build the instance and outputs the following playbook error:

TASK [Drupal] ******************************************************************

task path: /opt/ansible/playbook.yml:61
fatal: [localhost]: FAILED! => {\"msg\": \"The task includes an option with an undefined variable. The error was: 'git' is undefined

The error appears to have been in '/opt/ansible/playbook.yml': line 61, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  - name: Drupal
    ^ here

geerlingguy avatar Jul 22 '19 20:07 geerlingguy

I'm wondering if the version of the operator on Docker Hub is out of sync with master (https://hub.docker.com/r/8thom/drupal-operator), because I don't see any git variable or even the string git outside of the README.

geerlingguy avatar Jul 22 '19 20:07 geerlingguy

Yeah, looks like the playbook version in v0.0.1 has an initContainer which pulls a git repo containing a Drupal codebase, and then runs composer install --no-dev --ignore-platform-reqs on the codebase before passing that via a Docker volume to the Drupal Apache/PHP container:

              initContainers:
                - name: checkout
                  image: alpine/git
                  command:
                    - git
                    - clone
                    - --branch 
                    - '{{ git.branch }}'
                    - --single-branch
                    - --depth
                    - '1'
                    - '{{ git.repo }}'
                    - /app/drupal
                  volumeMounts:
                  - name: drupal-code
                    mountPath: /app/drupal/
                - name: composer
                  image: composer
                  command: 
                    - composer
                    - install
                    - --working-dir=/app/drupal
                    - --no-dev
                    - --ignore-platform-reqs
                  env:
                  - name: COMPOSER_CACHE_DIR
                    value: /composer/cache
                  volumeMounts:
                  - name: drupal-code
                    mountPath: /app/drupal/
                  - name: cache-volume
                    mountPath: /composer/cache/

It looks like there's a type: production attribute in the example CR; maybe you were working on a mode that would do a git clone of a real Drupal codebase to deploy it for a real-world environment, and that never made it up to GitHub, but you did push a new version of the container?

geerlingguy avatar Jul 22 '19 20:07 geerlingguy