チュートリアル:GitLab CI/CD コンポーネントを初... ノート
RSS GitLab

チュートリアル:GitLab CI/CD コンポーネントを初めて設定する方法

This tutorial demonstrates how to set up a GitLab CI/CD component to deploy Python scripts. A CI/CD component is a reusable single pipeline configuration unit that can be used to create a small part of a larger pipeline or compose a complete pipeline configuration. The tutorial uses a demo Python script that utilizes the ArgParse library to pass variables through the command line. The script takes in three arguments: Python container image, stage, and name.To test the script locally, users can call on the script using the command python3 src/script.py python_container_image stage name. The script can be modified to add in custom arguments. The tutorial also covers how to create a template for the CI/CD component, which includes defining inputs that can be passed through variables into the pipeline.The template includes three inputs: python_container_image, stage, and persons_name, each with a default value. These inputs can be overridden when using the component. The component also includes a before_script section that installs dependencies using pip3 and a script section that calls the Python script with the inputs.To use the component, users need to include it in the .gitlab-ci.yml file in the root of their directory. The component can be included by referencing it locally in the current project from the current Commit SHA. Users can override the default inputs by passing in custom values.The tutorial concludes by providing additional resources for learning more about CI/CD components and how to interact with the GitLab API using the GitLab Python library.