canonical / craft-parts

https://canonical-craft-parts.readthedocs-hosted.com
GNU Lesser General Public License v3.0
11 stars 37 forks source link

Permissions owner and group not applied #507

Open sergiusens opened 1 year ago

sergiusens commented 1 year ago

Bug Description

When used in Rockcraft, the directory in the shared yaml is still owned by root in the resulting image

To Reproduce

part yaml

zinc:
    plugin: go
    source: https://github.com/zincsearch/zincsearch
    source-type: git
    source-tag: v0.4.7
    build-snaps:
      - go/latest/stable
      - node/18/stable
    build-environment:
      - CGO_ENABLED: 0
      - GOOS: linux
    override-build: |
      COMMIT_HASH="$(git rev-parse HEAD)"
      BUILD_DATE="$(date -u '+%Y-%m-%d_%I:%M:%S%p-GMT')"

      # Build the web ui, which is embedded in the go binary later
      pushd web
      npm install
      npm run build
      popd

      go mod tidy
      go build \
        -ldflags="-s -w
        -X github.com/zincsearch/zincsearch/pkg/meta.Version=${CRAFT_PROJECT_VERSION} \
        -X github.com/zincsearch/zincsearch/pkg/meta.CommitHash=${COMMIT_HASH} \
        -X github.com/zincsearch/zincsearch/pkg/meta.BuildDate=${BUILD_DATE}" \
        -o zincsearch \
        cmd/zincsearch/main.go
    stage-packages:
      - libc6_libs
      - ca-certificates_data
    override-stage: |
      # Create some directories
      mkdir -p "${CRAFT_PART_INSTALL}/bin" "${CRAFT_PART_INSTALL}/var/lib/zincsearch"

      # Install the zincsearch binary
      install -m 0755 "${CRAFT_PART_BUILD}/zincsearch" "${CRAFT_PART_INSTALL}/bin/zincsearch"

      # Run the default stage hook
      craftctl default
    permissions:
      - path: /var/lib/zincsearch
        owner: 584792
        group: 584792
        mode: "755"

Relevant log output

n/a
syncronize-issues-to-jira[bot] commented 5 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2949.

This message was autogenerated