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

Broken Symlinks when Ubuntu 24.04 with Python plugin and override-prime is used #664

Open
alithethird opened this issue Aug 6, 2024 · 3 comments

Comments

@alithethird
Copy link

Bug Description

The fix for Ubuntu 24.04 with Python plugin doesn't work when override-prime is used. Doesn't even work when we use craftctl default in the override-prime.

To Reproduce

Write a rock with Ubuntu 24.04 and Python plugin and do something in override-prime.

Environment

Multipass
Ubuntu 22.04
Rockcraft 1.5.3

rockcraft.yaml

# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

name: indico
summary: Indico rock
description: Indico OCI image for the Indico charm
version: "1.0"
base: [email protected]
build-base: [email protected]
license: Apache-2.0
platforms:
  amd64:
parts:
  add-user:
    plugin: nil
    overlay-script: |
      chmod 755 $CRAFT_OVERLAY/etc
      groupadd -R $CRAFT_OVERLAY --gid 2000 indico
      useradd -R $CRAFT_OVERLAY --system --gid 2000 --uid 2000 --home /srv/indico indico
  indico:
    plugin: python
    build-environment:
      - UWSGI_EMBED_PLUGINS: stats_pusher_statsd
    python-packages:
      - setuptools
      - wheel
      - indico==3.3.1
      - indico-plugin-payment-paypal==3.3
      - indico-plugin-piwik
      - indico-plugin-storage-s3
      - python3-saml
      - uwsgi
      - ./anonymize
      - ./autocreate
    source: plugins
    build-packages:
      - build-essential
      - libpq-dev
      - libsasl2-dev
      - libxmlsec1-dev
      - pkg-config
      - wget
    stage-packages:
      - python3-venv
      - python3-dev
      - build-essential
      - ca-certificates
      - git-core
      - libglib2.0-data
      - libpq-dev
      - libsasl2-dev
      - locales
      - logrotate
      - pkg-config
      - postgresql-client
      - shared-mime-info
      - texlive-fonts-recommended
      - texlive-plain-generic
      - texlive-xetex
      - libpangocairo-1.0-0 # required for python3.12
    overlay-packages:
      - libxmlsec1-dev
    stage-snaps:
      - celery-prometheus-exporter/latest/edge
      - gtrkiller-statsd-prometheus-exporter/latest/edge
    override-prime: |
      mkdir -p --mode=775 $CRAFT_PART_INSTALL/srv/indico/{archive,cache,custom,etc,log,tmp}
      cp $CRAFT_PART_INSTALL/lib/python3.12/site-packages/indico/web/indico.wsgi $CRAFT_PART_INSTALL/srv/indico/indico.wsgi
      cp -R $CRAFT_PART_INSTALL/lib/python3.12/site-packages/indico/web/static $CRAFT_PART_INSTALL/srv/indico/
      chown -R 2000:2000 $CRAFT_PART_INSTALL/srv/indico
      cp /etc/ssl/certs/ca-certificates.crt  $CRAFT_PART_INSTALL/etc/ssl/certs/ca-certificates.crt
      craftctl default
  copy-config:
    plugin: dump
    source: .
    organize:
      start-indico.sh: srv/indico/start-indico.sh
      etc/logrotate.conf: srv/indico/logrotate.conf
    permissions:
      - owner: 2000
        group: 2000
      - path: srv/indico/start-indico.sh
        mode: "544"
      - path: etc/
        mode: "755"
    prime:
      - etc/*
      - srv/indico/start-indico.sh
      - srv/indico/logrotate.conf

Relevant log output

.
@tigarmo
Copy link
Collaborator

tigarmo commented Aug 6, 2024

It's an unfortunate limitation of override-prime today. However, your specific example is strange to me; it overrides prime to do manipulations on the part's install dir, which is used during the build. Is that intentional? Can you override build instead?

@alithethird
Copy link
Author

We were using override-prime with Ubuntu 22.04 version so I tried to keep it same but it failed. When I used override-stage it worked but did not try with override-build.

@tigarmo
Copy link
Collaborator

tigarmo commented Aug 6, 2024

My observation was more on the fact that I can't see how that project is working - for example, is /srv/indico/indico.wsgi really present on the final rock?

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