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

INPUT_TAGS still not working with multiple tags #958

Open
enlight3d opened this issue Feb 14, 2024 · 1 comment
Open

INPUT_TAGS still not working with multiple tags #958

enlight3d opened this issue Feb 14, 2024 · 1 comment

Comments

@enlight3d
Copy link

Hello @gperdomor, I'm opening a new issue concerning input tags because it seems it's still not working as intended when using multiple tags.

I've seen #356 and #764 which led me to https://github.com/gperdomor/nx-tools/blob/main/packages/nx-container/TROUBLESHOOTING.md#inline-execution.

Here is how I implemented in gitlab ci job :

build specific app on tag push:
  stage: build
  image: gperdomor/nx-kaniko:18.12.0-alpine
  variables:
    # Nx Container
    INPUT_PUSH: 'true' # To push your image to the registry
    INPUT_ENGINE: 'kaniko' # Override the engine to use for building the image
  before_script:
    - npm i -f
    - NX_HEAD=$CI_COMMIT_SHA
    - NX_BASE=${CI_COMMIT_BEFORE_SHA}
    # Login to registry
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json
  script:
    # Extract the module name from the tag : "platform/app-name/v1.0.0" => "app-name"
    - MODULE_NAME=$(echo $CI_COMMIT_TAG | cut -d'/' -f2)
    - MODULE_VERSION=$(echo $CI_COMMIT_TAG | cut -d'/' -f3)
    - echo "Building $MODULE_NAME..."
    - echo INPUT_TAGS="type=schedule\ntype=ref,event=branch\ntype=ref,event=pr\ntype=sha,prefix=sha-\ntype=raw,value=$MODULE_VERSION" > .env
    - npx nx container $MODULE_NAME --parallel=1
  rules:
    - if: '$CI_COMMIT_TAG'

And here is the relevant logs from the CI :

>  Removing temp folder /tmp/docker-build-push-HcICka 
>  NX   Unknown tag type attribute: schedule\ntype=ref
   Pass --verbose to see the stacktrace.

Help would be appreciated, for now I'll use only one tag for this specific job, but it could be nice if you could point me my mistake 😄

@tschaffter
Copy link

@enlight3d Have you found a solution for specifying inputs using environment variables as you described earlier?

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