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

[Enhancement] Provide includable gitlab-ci template #83

Closed
rndmh3ro opened this issue Mar 21, 2023 · 7 comments
Closed

[Enhancement] Provide includable gitlab-ci template #83

rndmh3ro opened this issue Mar 21, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@rndmh3ro
Copy link
Collaborator

Description

While we do have examples to setup a gitlab-pipeline for builds, I think it could help to have an include-template, that users can simply use.

Here's a first proposal on how this could look:

build_dmc:
  stage: docker_management_container
  image: docker:git
  services:
    - name: docker:dind
      alias: docker
  variables:
    # renovate: datasource=github-releases depName=docker-management-container
    GITHUB_DMC_TAG: 3.1.0
    SERVICE_NAME: foo
    DMC_IMAGE: $CI_REGISTRY_IMAGE/$SERVICE_NAME
  script:
    # get date for tagging the image
    - export DATE=$(date +"%F")
    # get DMC from GitHub
    - git clone --branch ${GITHUB_DMC_TAG} --depth 1 https://github.com/T-Systems-MMS/docker-management-container $CI_PROJECT_DIR/docker/docker-management-container
    # create Dockerfile with template from submodule
    - sh $CI_PROJECT_DIR/docker/docker-management-container/render.sh $CI_PROJECT_DIR/docker/$SERVICE_NAME
    # build and tag image
    - docker build -t ${DMC_IMAGE} $CI_PROJECT_DIR/docker/$SERVICE_NAME
    - docker tag $DMC_IMAGE:latest $DMC_IMAGE:${DATE} 
    # push images
    - docker push --all-tags ${DMC_IMAGE}
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule" && $JOB == "build_dmc"

Users would then have to add an include for this file, set the SERVICE_NAME, specify a separate docker-login-step and optionally add tags/other stuff they need.

Additional information

No response

@rndmh3ro rndmh3ro added the enhancement New feature or request label Mar 21, 2023
@rndmh3ro
Copy link
Collaborator Author

@rndmh3ro
Copy link
Collaborator Author

We also have to think about if the user wants to push the container to multiple registries.
Should we make the variable DMC_IMAGE a list and iterate over it?

Or should the user add a separate step to the job and include it with <<step?

@rndmh3ro
Copy link
Collaborator Author

Also see #84 (comment)

@rndmh3ro
Copy link
Collaborator Author

Seems there's no interest here.

@michaelamattes
Copy link
Collaborator

@rndmh3ro I'm interrested in this. I'll try this.

@michaelamattes
Copy link
Collaborator

@rndmh3ro Please take a look I've add a first setup for this #92.

@michaelamattes
Copy link
Collaborator

solved by #92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants