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

Unable to use modules with common base image artifact dependencies #5683

Closed
viglesiasce opened this issue Apr 15, 2021 · 2 comments
Closed
Labels
feature/multi-configs kind/friction Issues causing user pain that do not have a workaround kind/question User question

Comments

@viglesiasce
Copy link
Contributor

Expected behavior

Use a single base image (as per this example) between two modules and have a requires between one module and the other.

In this case I have a frontend and backend that share mostly the same build environment so I have a base Dockerfile shared between them.

Actual behavior

skaffold build throws an error due to duplicate artifacts:

❯ skaffold build
invalid skaffold config: found duplicate images "base": artifact image names must be unique across all configurations

Information

  • Skaffold version: v1.21.0
  • Operating system: MacOS arm64
  • Installed via: Cloud Code
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2beta13
kind: Config
metadata:
  name: frontend
requires:
  - path: ../backend
build:
  artifacts:
  - image: base
    context: ../../base
  - image: sample-app-frontend-dev
    requires:
      - alias: BASE
        image: base
deploy:
  kustomize:
    paths:
    - k8s/dev
profiles:
- name: prod
  deploy:
    kustomize:
      paths:
      - k8s/prod
---
apiVersion: skaffold/v2beta13
kind: Config
metadata:
  name: backend
build:
  artifacts:
  - image: base
    context: ../../base
  - image: sample-app-backend-dev
    docker:
      dockerfile: Dockerfile
deploy:
  kustomize:
    paths:
    - k8s/dev
profiles:
- name: prod
  deploy:
    kustomize:
      paths:
      - k8s/prod

Steps to reproduce the behavior

  1. Branch with setup available here:
    https://github.com/viglesiasce/sample-app/tree/base-pattern
@gsquared94
Copy link
Contributor

how about:

apiVersion: skaffold/v2beta13
kind: Config
metadata:
  name: base
build:
  artifacts:
  - image: base
    context: ../../base
---
apiVersion: skaffold/v2beta13
kind: Config
metadata:
  name: frontend
requires:
  - configs: [base, backend]
build:
  artifacts:
  - image: sample-app-frontend-dev
    requires:
      - alias: BASE
        image: base
deploy:
  kustomize:
    paths:
    - k8s/dev
profiles:
- name: prod
  deploy:
    kustomize:
      paths:
      - k8s/prod
---
apiVersion: skaffold/v2beta13
kind: Config
metadata:
  name: backend
requires:
  - configs: [base]
build:
  artifacts:
  - image: sample-app-backend-dev
    docker:
      dockerfile: Dockerfile
    requires:
    - alias: BASE
      image: base
deploy:
  kustomize:
    paths:
    - k8s/dev
profiles:
- name: prod
  deploy:
    kustomize:
      paths:
      - k8s/prod

The issue you're facing is that the artifact image property needs to be unique across. Also to declare a reusable base artifact it needs to be a single artifact.

@gsquared94 gsquared94 added feature/multi-configs kind/friction Issues causing user pain that do not have a workaround kind/question User question labels Apr 15, 2021
@viglesiasce
Copy link
Contributor Author

Got it! Tested this and it worked! I'm upstream my example so the end to end gets represented here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/multi-configs kind/friction Issues causing user pain that do not have a workaround kind/question User question
Projects
None yet
Development

No branches or pull requests

2 participants