#GitLab

1 messages · Page 1 of 1 (latest)

glass lake
#

Hi @fallen sentinel ,
Just created a dedicated thread so we can follow up more easily.
What SDK would you use?
We have an example for an old version of the CUE SDK, which uses the dagger CLI.
With the classic languages SDK, it would be run differently (go run myci.go deploy, node ci.js deploy, python ci.py deploy for example)

fallen sentinel
#

Thanks! I would use the Node JS SDK

fallen sentinel
#

For Node JS SDK, how to have a gitlab ci config with multiple steps?

fervent willow
#

We do exactly this, with gitlab

#

Just requires doing separate commands like Tanguy mentioned. In our case, that's pnpm dagger [step], e.g pnpm dagger release

fallen sentinel
#

Thanks @fervent willow for sharing your experience! So basically the content of each of your Gitlab tasks is just a Dagger step?

fervent willow
# fallen sentinel Thanks <@469974524214116373> for sharing your experience! So basically the conte...

yep, exactly. Here's an extract of the config (we generate ours on the fly)

stages:
- test
- build
- release
.build:
  script:
  - eval `ssh-agent -s`
  - chmod 400 $SSH_KEY
  - ssh-add $SSH_KEY > /dev/null
  - cd services/$RELEASE_TARGET/$SERVICE/ci
  - echo "running with args '$ARGS'"
  - pnpm dagger $ARGS --debug
  stage: build
  extends: .dagger
  variables:
    ARGS: build $SERVICE --target=$RELEASE_TARGET
  rules:
  - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
.dagger:
  before_script:
  - i=0; while [ "$i" -lt 12 ]; do docker info && break; sleep 5; i=$(( i + 1 )) ;
    done
  - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  - apk add nodejs npm
  - npm install -g corepack
  - corepack enable
  - corepack prepare pnpm@latest --activate
  - pnpm install --force
  - |-
    # install dagger
    cd /usr/local
    wget -O - https://dl.dagger.io/dagger/install.sh | sh
    cd -

    dagger version
  script:
  - echo "running with args '$ARGS'"
  - cd services/$RELEASE_TARGET/$SERVICE/ci
  - pnpm dagger $ARGS --debug
  extends: .docker
  variables:
    ARGS: ""
    DAGGER_CACHE_PATH: .dagger-cache
    DAGGER_LOG_FORMAT: plain
    DAGGER_VERSION: 0.3.7
    IMAGE_TAG: $CI_COMMIT_SHA
  cache:
    key: dagger-${CI_JOB_NAME}
    paths:
    - ${DAGGER_CACHE_PATH}
.docker:
  image: docker:${DOCKER_VERSION}-git
  variables:
    DOCKER_DRIVER: overlay2
    DOCKER_HOST: tcp://localhost:2375
    DOCKER_TLS_CERTDIR: ""
    DOCKER_VERSION: "20.10"
  services:
  - docker:${DOCKER_VERSION}-dind
.release:
  script:
  - eval `ssh-agent -s`
  - chmod 400 $SSH_KEY
  - ssh-add $SSH_KEY > /dev/null
  - cd services/$RELEASE_TARGET/$SERVICE/ci
  - pnpm dagger $ARGS --debug
  stage: release
  extends: .dagger
  variables:
    ARGS: release $SERVICE --publish --target=$RELEASE_TARGET --env=$APP_ENV
  rules:
  - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
.test:
  stage: test
  extends: .dagger
  variables:
    ARGS: test $SERVICE --target $RELEASE_TARGET
test billing-details-request:
  stage: test
  extends: .test
  variables:
    RELEASE_TARGET: application
    SERVICE: billing-details-request
  rules:
  - changes:
    - services/application/billing-details-request/**/*
  - when: manual
#

(there's various legacy things in how we call it atm which we're working to improve, but the general idea remains)

fallen sentinel
#

Thanks @fervent willow 🙏