diff --git a/Define and run a pipeline/.gitlab-ci.yml b/Define and run a pipeline/.gitlab-ci.yml index b1423bc607572b7d8bffd25cee43a936ff4c061e..50db7fc07bbe0f3f4b2995ee74cd6b86e4e8b6d8 100644 --- a/Define and run a pipeline/.gitlab-ci.yml +++ b/Define and run a pipeline/.gitlab-ci.yml @@ -1,7 +1,3 @@ -#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 - workflow: rules: - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main" @@ -26,27 +22,21 @@ 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 @@ -59,10 +49,9 @@ job_publish: script: - | for artifact in ./artifacts/*; do - chmod +x ${artifact} + chmod +x ${artifact} curl \ --header "Job-TOKEN: ${CI_JOB_TOKEN}" \ --upload-file ${artifact} \ "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/artifacts/${version}/" - done - + done \ No newline at end of file