From 7e3e336a9cbfc5fbfa001446a589dfcbf56cc06e Mon Sep 17 00:00:00 2001 From: ludo8147 <ludo8147@bht-berlin.de> Date: Sat, 7 Sep 2024 07:51:07 +0200 Subject: [PATCH] corrected yaml --- .gitlab-ci.yml | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 744a468..50db7fc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,11 @@ -#Code: https://github.com/lucendio/lecture-devops-code/blob/master/tutorials/define-and-run-pipeline/.gitlab-ci.yml -# und Vorlesung -#https://docs.gitlab.com/ee/user/packages/container_registry/build_and_push_images.html -#https://docs.gitlab.com/ee/ci/yaml/workflow.html - workflow: rules: - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main" when: always +variables: + version: 0.0.$CI_PIPELINE_IID + stages: - 'build' - 'test' @@ -24,41 +22,36 @@ job_build: image: 'mirror.gcr.io/library/golang:1.21' parallel: matrix: - - GOOS: - - 'linux' - - 'windows' - - 'darwin' - GOARCH: - - 'amd64' - - 'arm64' + - GOOS: ['linux', 'windows', 'darwin'] + GOARCH: ['amd64', 'arm64'] before_script: - mkdir -p ./artifacts - script: + script: - | - go build \ - -o ./artifacts/webservice_${GOOS}_${GOARCH}.bin \ - ./*.go + go build \ + -o ./artifacts/webservice_${GOOS}_${GOARCH}.bin \ + ./*.go artifacts: paths: - ./artifacts job_publish: stage: 'publish' - rules: image: 'public.ecr.aws/lts/ubuntu:22.04' tags: - docker-privileged dependencies: - job_build - before-script: + before_script: - apt update - apt install -y ca-certificates curl - update-ca-certificates script: - | for artifact in ./artifacts/*; do + chmod +x ${artifact} curl \ --header "Job-TOKEN: ${CI_JOB_TOKEN}" \ --upload-file ${artifact} \ - "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/artifacts/latest/" + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/artifacts/${version}/" done \ No newline at end of file -- GitLab