From 10dda4dc730c5c8dcfd30460ccb6e5ad78736fbe Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Tue, 2 May 2023 19:39:49 -0400 Subject: [PATCH] Update gitlab config file gitlab seems to require a .yml extension (not .yaml). The actual syntax was also quite wrong. And the image golang:1.20 does not need (nor contain 'sudo'). Signed-off-by: Marc Khouzam --- .../plugintemplates/gitlab-ci.yaml.tmpl | 21 ------------------- .../plugintemplates/gitlab-ci.yml.tmpl | 20 ++++++++++++++++++ .../template/plugintemplates/templates.go | 2 +- cmd/plugin/builder/template/root.go | 2 +- 4 files changed, 22 insertions(+), 23 deletions(-) delete mode 100644 cmd/plugin/builder/template/plugintemplates/gitlab-ci.yaml.tmpl create mode 100644 cmd/plugin/builder/template/plugintemplates/gitlab-ci.yml.tmpl diff --git a/cmd/plugin/builder/template/plugintemplates/gitlab-ci.yaml.tmpl b/cmd/plugin/builder/template/plugintemplates/gitlab-ci.yaml.tmpl deleted file mode 100644 index 7369900c9..000000000 --- a/cmd/plugin/builder/template/plugintemplates/gitlab-ci.yaml.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -build: - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_BRANCH == "main" -stage: build -image: golang:1.20 -script: - - sudo apt-get update - - sudo apt-get install -y ca-certificates - - sudo echo "deb https://storage.googleapis.com/tanzu-cli-os-packages/apt tanzu-cli-jessie main" | sudo tee /etc/apt/sources.list.d/tanzu.list - - sudo apt-get update --allow-insecure-repositories - - sudo apt-get install -y tanzu-cli --allow-unauthenticated - - - tanzu ceip-participation set false - - tanzu version - - tanzu plugin install builder - - - make plugin-build-install-local - - - make test - - - make lint diff --git a/cmd/plugin/builder/template/plugintemplates/gitlab-ci.yml.tmpl b/cmd/plugin/builder/template/plugintemplates/gitlab-ci.yml.tmpl new file mode 100644 index 000000000..4b972e69f --- /dev/null +++ b/cmd/plugin/builder/template/plugintemplates/gitlab-ci.yml.tmpl @@ -0,0 +1,20 @@ +default: + image: golang:1.20 + +stages: +- build + +build-job: + stage: build + script: + - apt-get update + - apt-get install -y ca-certificates + - echo "deb https://storage.googleapis.com/tanzu-cli-os-packages/apt tanzu-cli-jessie main" | tee /etc/apt/sources.list.d/tanzu.list + - apt-get update --allow-insecure-repositories + - apt-get install -y tanzu-cli --allow-unauthenticated + - tanzu ceip-participation set false + - tanzu version + - tanzu plugin install builder + - make plugin-build-install-local + - make test + - make lint diff --git a/cmd/plugin/builder/template/plugintemplates/templates.go b/cmd/plugin/builder/template/plugintemplates/templates.go index b633e3111..932940c89 100644 --- a/cmd/plugin/builder/template/plugintemplates/templates.go +++ b/cmd/plugin/builder/template/plugintemplates/templates.go @@ -57,5 +57,5 @@ var GithubWorkflowBuild string // GitlabCI contains the Gitlab CI template // -//go:embed gitlab-ci.yaml.tmpl +//go:embed gitlab-ci.yml.tmpl var GitlabCI string diff --git a/cmd/plugin/builder/template/root.go b/cmd/plugin/builder/template/root.go index 1ca89079e..b1d968cc1 100644 --- a/cmd/plugin/builder/template/root.go +++ b/cmd/plugin/builder/template/root.go @@ -22,7 +22,7 @@ var GitIgnore = Target{ // GitLabCI target var GitLabCI = Target{ - Filepath: ".gitlab-ci.yaml", + Filepath: ".gitlab-ci.yml", Template: plugintemplates.GitlabCI, }