From 5a324aa20ca83b66478d84cd337ecafea8e060c0 Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 27 Sep 2022 14:01:09 +0200 Subject: [PATCH 01/18] Add internal CI --- Jenkinsfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000000..c06e7256ec54 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,17 @@ +pipeline { + agent any + + stages { + + stage('Test Build') { + script { + docker.image("dockerhub.rnd.amadeus.net/docker-production-iac/iac/terraform-automation-azr:master-004346b").inside("-u iacuser") { + sh 'wget -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' + sh 'tar -xf -C /tmp/ /tmp/goreleaser.tar.gz' + sh '/tmp/goreleaser -h' + } + } + } + } + +} \ No newline at end of file From d3400efcad3f8d028261c79efb852007124ee6d4 Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 27 Sep 2022 14:10:41 +0200 Subject: [PATCH 02/18] SACP:47873: Removing stage from Jenkinsfile --- Jenkinsfile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c06e7256ec54..c372f11f5834 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,15 +2,12 @@ pipeline { agent any stages { - stage('Test Build') { - script { - docker.image("dockerhub.rnd.amadeus.net/docker-production-iac/iac/terraform-automation-azr:master-004346b").inside("-u iacuser") { - sh 'wget -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' - sh 'tar -xf -C /tmp/ /tmp/goreleaser.tar.gz' - sh '/tmp/goreleaser -h' - } - } + docker.image("dockerhub.rnd.amadeus.net/docker-production-iac/iac/terraform-automation-azr:master-004346b").inside("-u iacuser") { + sh 'wget -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' + sh 'tar -xf -C /tmp/ /tmp/goreleaser.tar.gz' + sh '/tmp/goreleaser -h' + } } } From b9862b9c1c18b7e5d82106e9584ac402074c7c11 Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 27 Sep 2022 14:13:09 +0200 Subject: [PATCH 03/18] SACP:47873: changes --- Jenkinsfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c372f11f5834..2e986c0807df 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,13 +1,17 @@ +@Library(['pipeline-toolbox', 'iac-pipeline-shared-lib']) _ + pipeline { agent any stages { stage('Test Build') { - docker.image("dockerhub.rnd.amadeus.net/docker-production-iac/iac/terraform-automation-azr:master-004346b").inside("-u iacuser") { + script { + docker.image("dockerhub.rnd.amadeus.net/docker-production-iac/iac/terraform-automation-azr:master-004346b").inside("-u iacuser") { sh 'wget -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' sh 'tar -xf -C /tmp/ /tmp/goreleaser.tar.gz' sh '/tmp/goreleaser -h' - } + } + } } } From 2ddd4ed04f6ccf62894fd25dd1b3b57299530c9e Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 27 Sep 2022 14:14:14 +0200 Subject: [PATCH 04/18] SACP:47873: changes --- Jenkinsfile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2e986c0807df..4b0fbe09dc1f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,13 +5,15 @@ pipeline { stages { stage('Test Build') { - script { - docker.image("dockerhub.rnd.amadeus.net/docker-production-iac/iac/terraform-automation-azr:master-004346b").inside("-u iacuser") { - sh 'wget -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' - sh 'tar -xf -C /tmp/ /tmp/goreleaser.tar.gz' - sh '/tmp/goreleaser -h' - } - } + steps { + script { + docker.image("dockerhub.rnd.amadeus.net/docker-production-iac/iac/terraform-automation-azr:master-004346b").inside("-u iacuser") { + sh 'wget -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' + sh 'tar -xf -C /tmp/ /tmp/goreleaser.tar.gz' + sh '/tmp/goreleaser -h' + } + } + } } } From 99128205224d8d06fa8c8078715ee27bc5ab1473 Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 27 Sep 2022 14:17:50 +0200 Subject: [PATCH 05/18] SACP:47873: changes --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4b0fbe09dc1f..3ea2470fd0b4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { stage('Test Build') { steps { script { - docker.image("dockerhub.rnd.amadeus.net/docker-production-iac/iac/terraform-automation-azr:master-004346b").inside("-u iacuser") { + docker.image("dockerhub.rnd.amadeus.net/docker-production/iac/terraform-automation-azr:2.7.2").inside("-u iacuser") { sh 'wget -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' sh 'tar -xf -C /tmp/ /tmp/goreleaser.tar.gz' sh '/tmp/goreleaser -h' From 44c498befb160fb8674ed2abbc69ca91e89391e1 Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 27 Sep 2022 14:23:14 +0200 Subject: [PATCH 06/18] SACP:47873: changes --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3ea2470fd0b4..bab70e75bcb2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,8 +8,8 @@ pipeline { steps { script { docker.image("dockerhub.rnd.amadeus.net/docker-production/iac/terraform-automation-azr:2.7.2").inside("-u iacuser") { - sh 'wget -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' - sh 'tar -xf -C /tmp/ /tmp/goreleaser.tar.gz' + sh 'wget -q -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' + sh 'tar -xf /tmp/goreleaser.tar.gz --directory /tmp/' sh '/tmp/goreleaser -h' } } From 58d807d932b265c50c5fd89a2c64fa4a934cc43b Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 27 Sep 2022 14:26:49 +0200 Subject: [PATCH 07/18] SACP:47873: changes --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index bab70e75bcb2..9487659c495e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { docker.image("dockerhub.rnd.amadeus.net/docker-production/iac/terraform-automation-azr:2.7.2").inside("-u iacuser") { sh 'wget -q -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' sh 'tar -xf /tmp/goreleaser.tar.gz --directory /tmp/' - sh '/tmp/goreleaser -h' + sh '/tmp/goreleaser release --snapshot --rm-dist' } } } From 1bacd302a7b215809224876b9ae0e69b78c79e1e Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 27 Sep 2022 15:00:21 +0200 Subject: [PATCH 08/18] SACP:47873: changes --- .goreleaser.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 3e1157c789c0..c1951652b9f6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -15,8 +15,8 @@ builds: flags: - -trimpath goos: - - darwin - - freebsd + #- darwin + #- freebsd - linux - windows goarch: From 5a39c535d0ed6b225e5b5af73327581f0d6700f1 Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 4 Oct 2022 11:47:35 +0200 Subject: [PATCH 09/18] with parallelism=2 --- .goreleaser.yml | 4 +- Jenkinsfile | 2 +- dist/config.yaml | 173 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 dist/config.yaml diff --git a/.goreleaser.yml b/.goreleaser.yml index c1951652b9f6..3e1157c789c0 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -15,8 +15,8 @@ builds: flags: - -trimpath goos: - #- darwin - #- freebsd + - darwin + - freebsd - linux - windows goarch: diff --git a/Jenkinsfile b/Jenkinsfile index 9487659c495e..c73ee5bc3c65 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { docker.image("dockerhub.rnd.amadeus.net/docker-production/iac/terraform-automation-azr:2.7.2").inside("-u iacuser") { sh 'wget -q -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' sh 'tar -xf /tmp/goreleaser.tar.gz --directory /tmp/' - sh '/tmp/goreleaser release --snapshot --rm-dist' + sh '/tmp/goreleaser release --snapshot --rm-dist --parallelism=2' } } } diff --git a/dist/config.yaml b/dist/config.yaml new file mode 100644 index 000000000000..8510843b6838 --- /dev/null +++ b/dist/config.yaml @@ -0,0 +1,173 @@ +project_name: terraform-provider-azurerm +release: + github: + owner: iac + name: terraform-provider-azurerm + name_template: '{{.Tag}}' + ids: + - none + extra_files: + - glob: terraform-registry-manifest.json + name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' +scoop: + name: terraform-provider-azurerm + commit_author: + name: goreleaserbot + email: goreleaser@carlosbecker.com + commit_msg_template: Scoop update for {{ .ProjectName }} version {{ .Tag }} +builds: +- id: terraform-provider-azurerm + goos: + - darwin + - freebsd + - linux + - windows + goarch: + - "386" + - amd64 + - arm + - arm64 + goarm: + - "6" + gomips: + - hardfloat + targets: + - darwin_amd64 + - darwin_arm64 + - freebsd_386 + - freebsd_amd64 + - freebsd_arm_6 + - linux_386 + - linux_amd64 + - linux_arm_6 + - linux_arm64 + - windows_386 + - windows_amd64 + ignore: + - goos: windows + goarch: arm + - goos: freebsd + goarch: arm64 + - goos: windows + goarch: arm64 + dir: . + main: . + binary: '{{ .ProjectName }}_v{{ .Version }}_x5' + env: + - CGO_ENABLED=0 + builder: go + mod_timestamp: '{{ .CommitTimestamp }}' + gobinary: go + ldflags: + - -s -w -X main.Version={{.Version}} + flags: + - -trimpath +archives: +- id: default + builds: + - terraform-provider-azurerm + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' + format: zip + files: + - src: none* +snapshot: + name_template: '{{ .Tag }}-next' +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' + algorithm: sha256 + extra_files: + - glob: terraform-registry-manifest.json + name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' +publishers: +- name: upload + checksum: true + signature: true + cmd: hc-releases upload -product {{ .ProjectName }} -version {{ .Version }} -file={{ + .ArtifactPath }}={{ .ArtifactName }} -header=x-terraform-protocol-version=5 -header=x-terraform-protocol-versions=5.0 + env: + - HC_RELEASES_HOST={{ .Env.HC_RELEASES_HOST }} + - HC_RELEASES_KEY={{ .Env.HC_RELEASES_KEY }} + extra_files: + - glob: terraform-registry-manifest.json + name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' +dist: dist +signs: +- id: default + cmd: signore + args: + - sign + - --dearmor + - --file + - ${artifact} + - --out + - ${signature} + signature: ${artifact}.sig + artifacts: checksum +- id: key-id + cmd: signore + args: + - sign + - --dearmor + - --file + - ${artifact} + - --out + - ${signature} + signature: ${artifact}.72D7468F.sig + artifacts: checksum +env_files: + github_token: ~/.config/goreleaser/github_token + gitlab_token: ~/.config/goreleaser/gitlab_token + gitea_token: ~/.config/goreleaser/gitea_token +before: + hooks: + - go mod download +source: + name_template: '{{ .ProjectName }}-{{ .Version }}' + format: tar.gz +gomod: + gobinary: go +announce: + twitter: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL + }}' + reddit: + title_template: '{{ .ProjectName }} {{ .Tag }} is out!' + url_template: '{{ .ReleaseURL }}' + slack: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL + }}' + username: GoReleaser + discord: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL + }}' + author: GoReleaser + color: "3888754" + icon_url: https://goreleaser.com/static/avatar.png + teams: + title_template: '{{ .ProjectName }} {{ .Tag }} is out!' + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL + }}' + color: '#2D313E' + icon_url: https://goreleaser.com/static/avatar.png + smtp: + subject_template: '{{ .ProjectName }} {{ .Tag }} is out!' + body_template: 'You can view details from: {{ .ReleaseURL }}' + mattermost: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL + }}' + title_template: '{{ .ProjectName }} {{ .Tag }} is out!' + username: GoReleaser + linkedin: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL + }}' + telegram: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL + }}' + webhook: + message_template: '{ "message": "{{ .ProjectName }} {{ .Tag }} is out! Check it + out at {{ .ReleaseURL }}"}' + content_type: application/json; charset=utf-8 +github_urls: + download: https://github.com +gitlab_urls: + download: https://gitlab.com From 38d86b66c3593f616607cbd3ea59bf88984186c9 Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Wed, 12 Oct 2022 10:14:17 +0200 Subject: [PATCH 10/18] Changes --- .goreleaser.yml | 30 +++++--- Jenkinsfile | 14 +++- dist/config.yaml | 173 ----------------------------------------------- 3 files changed, 32 insertions(+), 185 deletions(-) delete mode 100644 dist/config.yaml diff --git a/.goreleaser.yml b/.goreleaser.yml index 3e1157c789c0..391bef7bc879 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -60,15 +60,27 @@ release: name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' ids: - none +#signs: +# - args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"] +# artifacts: checksum +# cmd: signore +# signature: ${artifact}.sig +# - args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"] +# artifacts: checksum +# cmd: signore +# id: key-id +# signature: ${artifact}.72D7468F.sig signs: - - args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"] - artifacts: checksum - cmd: signore - signature: ${artifact}.sig - - args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"] - artifacts: checksum - cmd: signore - id: key-id - signature: ${artifact}.72D7468F.sig + - artifacts: checksum + args: + # if you are using this in a GitHub action or some other automated pipeline, you + # need to pass the batch flag to indicate its not interactive. + - "--batch" + - "--local-user" + - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key + - "--output" + - "${signature}" + - "--detach-sign" + - "${artifact}" snapshot: name_template: "{{ .Tag }}-next" diff --git a/Jenkinsfile b/Jenkinsfile index c73ee5bc3c65..c1677f7cfcc6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,9 +8,17 @@ pipeline { steps { script { docker.image("dockerhub.rnd.amadeus.net/docker-production/iac/terraform-automation-azr:2.7.2").inside("-u iacuser") { - sh 'wget -q -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' - sh 'tar -xf /tmp/goreleaser.tar.gz --directory /tmp/' - sh '/tmp/goreleaser release --snapshot --rm-dist --parallelism=2' + withCredentials([ + string(credentialsId: 'GPG_FINGERPRINT', variable: 'GPG_FINGERPRINT'), + file(credentialsId: 'ash-gpg-key', variable: 'ASH_GPG_KEY') + ]) { + sh 'cp "${ASH_GPG_KEY}" .' + sh 'gpg --import ash-gpg-key && rm -rf ash-gpg-key' + sh 'wget -q -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' + sh 'tar -xf /tmp/goreleaser.tar.gz --directory /tmp/' + sh '/tmp/goreleaser release --snapshot --rm-dist --parallelism=2' + sh 'ls -lart dist/' + } } } } diff --git a/dist/config.yaml b/dist/config.yaml deleted file mode 100644 index 8510843b6838..000000000000 --- a/dist/config.yaml +++ /dev/null @@ -1,173 +0,0 @@ -project_name: terraform-provider-azurerm -release: - github: - owner: iac - name: terraform-provider-azurerm - name_template: '{{.Tag}}' - ids: - - none - extra_files: - - glob: terraform-registry-manifest.json - name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' -scoop: - name: terraform-provider-azurerm - commit_author: - name: goreleaserbot - email: goreleaser@carlosbecker.com - commit_msg_template: Scoop update for {{ .ProjectName }} version {{ .Tag }} -builds: -- id: terraform-provider-azurerm - goos: - - darwin - - freebsd - - linux - - windows - goarch: - - "386" - - amd64 - - arm - - arm64 - goarm: - - "6" - gomips: - - hardfloat - targets: - - darwin_amd64 - - darwin_arm64 - - freebsd_386 - - freebsd_amd64 - - freebsd_arm_6 - - linux_386 - - linux_amd64 - - linux_arm_6 - - linux_arm64 - - windows_386 - - windows_amd64 - ignore: - - goos: windows - goarch: arm - - goos: freebsd - goarch: arm64 - - goos: windows - goarch: arm64 - dir: . - main: . - binary: '{{ .ProjectName }}_v{{ .Version }}_x5' - env: - - CGO_ENABLED=0 - builder: go - mod_timestamp: '{{ .CommitTimestamp }}' - gobinary: go - ldflags: - - -s -w -X main.Version={{.Version}} - flags: - - -trimpath -archives: -- id: default - builds: - - terraform-provider-azurerm - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' - format: zip - files: - - src: none* -snapshot: - name_template: '{{ .Tag }}-next' -checksum: - name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' - algorithm: sha256 - extra_files: - - glob: terraform-registry-manifest.json - name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' -publishers: -- name: upload - checksum: true - signature: true - cmd: hc-releases upload -product {{ .ProjectName }} -version {{ .Version }} -file={{ - .ArtifactPath }}={{ .ArtifactName }} -header=x-terraform-protocol-version=5 -header=x-terraform-protocol-versions=5.0 - env: - - HC_RELEASES_HOST={{ .Env.HC_RELEASES_HOST }} - - HC_RELEASES_KEY={{ .Env.HC_RELEASES_KEY }} - extra_files: - - glob: terraform-registry-manifest.json - name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' -dist: dist -signs: -- id: default - cmd: signore - args: - - sign - - --dearmor - - --file - - ${artifact} - - --out - - ${signature} - signature: ${artifact}.sig - artifacts: checksum -- id: key-id - cmd: signore - args: - - sign - - --dearmor - - --file - - ${artifact} - - --out - - ${signature} - signature: ${artifact}.72D7468F.sig - artifacts: checksum -env_files: - github_token: ~/.config/goreleaser/github_token - gitlab_token: ~/.config/goreleaser/gitlab_token - gitea_token: ~/.config/goreleaser/gitea_token -before: - hooks: - - go mod download -source: - name_template: '{{ .ProjectName }}-{{ .Version }}' - format: tar.gz -gomod: - gobinary: go -announce: - twitter: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL - }}' - reddit: - title_template: '{{ .ProjectName }} {{ .Tag }} is out!' - url_template: '{{ .ReleaseURL }}' - slack: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL - }}' - username: GoReleaser - discord: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL - }}' - author: GoReleaser - color: "3888754" - icon_url: https://goreleaser.com/static/avatar.png - teams: - title_template: '{{ .ProjectName }} {{ .Tag }} is out!' - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL - }}' - color: '#2D313E' - icon_url: https://goreleaser.com/static/avatar.png - smtp: - subject_template: '{{ .ProjectName }} {{ .Tag }} is out!' - body_template: 'You can view details from: {{ .ReleaseURL }}' - mattermost: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL - }}' - title_template: '{{ .ProjectName }} {{ .Tag }} is out!' - username: GoReleaser - linkedin: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL - }}' - telegram: - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL - }}' - webhook: - message_template: '{ "message": "{{ .ProjectName }} {{ .Tag }} is out! Check it - out at {{ .ReleaseURL }}"}' - content_type: application/json; charset=utf-8 -github_urls: - download: https://github.com -gitlab_urls: - download: https://gitlab.com From 1f9b0fa6c7733af96d500ca1cf30479d95b14b82 Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Fri, 14 Oct 2022 13:01:29 +0200 Subject: [PATCH 11/18] Changes --- .goreleaser.yml | 24 ++++++++++++++++++------ Jenkinsfile | 5 +++-- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 391bef7bc879..519e13764206 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -15,15 +15,15 @@ builds: flags: - -trimpath goos: - - darwin - - freebsd + #- darwin + #- freebsd - linux - - windows + #- windows goarch: - - '386' + #- '386' - amd64 - - arm - - arm64 + #- arm + #- arm64 ignore: - goarch: arm goos: windows @@ -55,6 +55,7 @@ publishers: name: upload signature: true release: + disable: true extra_files: - glob: 'terraform-registry-manifest.json' name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' @@ -82,5 +83,16 @@ signs: - "${signature}" - "--detach-sign" - "${artifact}" +artifactories: + - name: production + target: https://repository.rnd.amadeus.net/artifactory/generic-production-iac/providers/azurerm/{{ .ProjectName }}/{{ .Version }}/ + #target: http://:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/ + username: "swb2-izu-iac" + # Upload checksums (defaults to false) + checksum: true + # Upload signatures (defaults to false) + signature: true snapshot: name_template: "{{ .Tag }}-next" +changelog: + skip: true \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index c1677f7cfcc6..f5f75341a828 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,13 +10,14 @@ pipeline { docker.image("dockerhub.rnd.amadeus.net/docker-production/iac/terraform-automation-azr:2.7.2").inside("-u iacuser") { withCredentials([ string(credentialsId: 'GPG_FINGERPRINT', variable: 'GPG_FINGERPRINT'), - file(credentialsId: 'ash-gpg-key', variable: 'ASH_GPG_KEY') + file(credentialsId: 'ash-gpg-key', variable: 'ASH_GPG_KEY'), + usernamePassword(credentialsId: ' goreleaser-artifactory-creds', usernameVariable: 'ARTIFACTORY_PRODUCTION_USERNAME', passwordVariable: 'ARTIFACTORY_PRODUCTION_SECRET') ]) { sh 'cp "${ASH_GPG_KEY}" .' sh 'gpg --import ash-gpg-key && rm -rf ash-gpg-key' sh 'wget -q -O /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.11.4/goreleaser_Linux_x86_64.tar.gz' sh 'tar -xf /tmp/goreleaser.tar.gz --directory /tmp/' - sh '/tmp/goreleaser release --snapshot --rm-dist --parallelism=2' + sh '/tmp/goreleaser release --rm-dist --parallelism=2' sh 'ls -lart dist/' } } From affd5ebc80dc3d541c277a5c2166af162bcbe70b Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Fri, 21 Oct 2022 15:21:26 +0200 Subject: [PATCH 12/18] SACP-47573: Adding internal CI --- .goreleaser-jenkins.yml | 78 +++++++++++++++++++++++++++++++++++++++++ Jenkinsfile | 78 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 .goreleaser-jenkins.yml create mode 100644 Jenkinsfile diff --git a/.goreleaser-jenkins.yml b/.goreleaser-jenkins.yml new file mode 100644 index 000000000000..5d7448a01ff8 --- /dev/null +++ b/.goreleaser-jenkins.yml @@ -0,0 +1,78 @@ +# Visit https://goreleaser.com for documentation on how to customize this +# behavior. +before: + hooks: + # this is just an example and not a requirement for provider building/publishing + - go mod tidy +dist: dist2/ +builds: +- env: + # goreleaser does not work with CGO, it could also complicate + # usage by users in CI/CD systems like Terraform Cloud where + # they are unable to install libraries. + - CGO_ENABLED=0 + mod_timestamp: '{{ .CommitTimestamp }}' + flags: + - -trimpath + ldflags: + - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' + goos: + - freebsd + - windows + - linux + - darwin + goarch: + - amd64 + - '386' + - arm + - arm64 + binary: '{{ .ProjectName }}_v{{ .Version }}_x4' +archives: +- format: zip + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' + algorithm: sha256 +signs: + - artifacts: checksum + args: + # if you are using this in a GitHub action or some other automated pipeline, you + # need to pass the batch flag to indicate its not interactive. + - "--batch" + - "--local-user" + - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key + - "--output" + - "${signature}" + - "--detach-sign" + - "${artifact}" + +artifactories: + - name: production + target: https://repository.rnd.amadeus.net/artifactory/generic-production-iac/providers/azurerm/{{ .ProjectName }}/{{ .Version }}/ + #target: http://:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/ + # Upload checksums (defaults to false) + checksum: true + # Upload signatures (defaults to false) + signature: true + +publishers: + - name: Generate and Publish provider metadata + cmd: >- + tf-provider-registry-api-generator + --bucket-name 'generic-production-iac' + --terraform-provider '{{ .ProjectName }}' + --namespace 'amadeus' + --fingerprint '{{ .Env.GPG_FINGERPRINT }}' + --provider-version {{ .Tag }} + env: + - "PATH={{ .Env.PATH }}" + - "MUC_ARTIFACTORY_TOKEN={{ .Env.MUC_ARTIFACTORY_TOKEN }}" + - "RND_ARTIFACTORY_TOKEN={{ .Env.RND_ARTIFACTORY_TOKEN }}" + +release: + # to disable automatic push to github as we use artifactory + disable: true + # If you want to manually examine the release before its live, uncomment this line: + # draft: true +changelog: + skip: true \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000000..1b12a17ae71e --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,78 @@ +/* groovylint-disable DuplicateMapLiteral, LineLength */ +/* groovylint-disable-next-line CompileStatic, NoDef, UnusedVariable, VariableName, VariableTypeRequired */ +@Library(['pipeline-toolbox', 'iac-pipeline-shared-lib']) _ + +node { + try { + stage('Setup') { + artifactName = env.BITBUCKET_REPOSITORY + checkoutGit() + terraformAutoImageVersion = '1.0.2' + baseTerraformAutoImage = "docker-production-iac/iac/tf-plugin-builder:${terraformAutoImageVersion}" + baseVersion = 'v1.0' + newVersion = newVersion(baseVersion) + '-amadeus' + registry = 'repository.adp.amadeus.net' + baseImage = 'maven:3.6.3-jdk-11' + // pageId for https://rndwww.nce.amadeus.net/confluence/display/IBSDC/IaC+Release+Notes + //releaseNotesOptions = ['spaceKey': 'IBSDC', 'parentPageId': 1654937615] + } + + stage('QA tests and goreleaser to release locally (not pushing to artifactory yet)') { + /* groovylint-disable-next-line UnnecessaryGetter */ + when(isPullRequest()) { + docker.withRegistry("https://${registry}") { + /* groovylint-disable-next-line NestedBlockDepth */ + docker.image(baseTerraformAutoImage).inside { + withCredentials([ + usernamePassword(credentialsId: 'goreleaser-artifactory-creds', usernameVariable: 'ARTIFACTORY_PRODUCTION_USERNAME', passwordVariable: 'ARTIFACTORY_PRODUCTION_SECRET'), + usernamePassword(credentialsId: 'RND-ARTIFACTORY-TOKEN', usernameVariable: 'RND_ARTIFACTORY_USER', passwordVariable: 'RND_ARTIFACTORY_TOKEN'), + usernamePassword(credentialsId: 'MUC_ARTIFACTORY_REGISTRY_TOKEN', usernameVariable: 'MUC_REGISTRY_HOST', passwordVariable: 'MUC_ARTIFACTORY_TOKEN') + /* groovylint-disable-next-line NestedBlockDepth */ + ]) { + sh ''' + make fmtcheck + make test + #not running acceptance tests now + #make testacc + echo -e "credentials \\"$MUC_REGISTRY_HOST\\" {\n token = \\"$MUC_ARTIFACTORY_TOKEN\\"\n}\n" > .terraformrc + goreleaser release --snapshot --rm-dist --config .goreleaser-jenkins.yml --parallelism=2 + ''' + } + } + } + } + } + + stage('Increment Tag && gorelease to artifactory') { + withCredentials([ + /* groovylint-disable-next-line DuplicateStringLiteral */ + usernamePassword(credentialsId: 'goreleaser-artifactory-creds', usernameVariable: 'ARTIFACTORY_PRODUCTION_USERNAME', passwordVariable: 'ARTIFACTORY_PRODUCTION_SECRET'), + /* groovylint-disable-next-line DuplicateStringLiteral */ + usernamePassword(credentialsId: 'RND-ARTIFACTORY-TOKEN', usernameVariable: 'RND_ARTIFACTORY_USER', passwordVariable: 'RND_ARTIFACTORY_TOKEN'), + /* groovylint-disable-next-line DuplicateStringLiteral */ + usernamePassword(credentialsId: 'MUC_ARTIFACTORY_REGISTRY_TOKEN', usernameVariable: 'MUC_REGISTRY_HOST', passwordVariable: 'MUC_ARTIFACTORY_TOKEN') + ]) { + /* groovylint-disable-next-line UnnecessaryGetter */ + when(env.BRANCH_NAME == 'master' || isReleasedBranch()) { + pushNewVersionTag(newVersion, baseVersion, releaseNotesOptions) + /* groovylint-disable-next-line DuplicateStringLiteral, NestedBlockDepth */ + docker.withRegistry("https://${registry}") { + /* groovylint-disable-next-line NestedBlockDepth */ + docker.image(baseTerraformAutoImage).inside { + /* groovylint-disable-next-line GStringExpressionWithinString */ + sh ''' + echo -e "credentials \\"$MUC_REGISTRY_HOST\\" {\n token = \\"$MUC_ARTIFACTORY_TOKEN\\"\n}\n" > .terraformrc + goreleaser release --rm-dist --config .goreleaser-jenkins.yml --parallelism=2 + ''' + } + } + } + } + } + } catch (err) { + echo "Caught: ${err}" + currentBuild.result = 'FAILURE' + } finally { + echo 'Done' + } +} From 6d1953a834749477c5693b3fef7a441b1ef0869a Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Fri, 21 Oct 2022 15:26:57 +0200 Subject: [PATCH 13/18] SACP-47573: Fallback to Amadeus versioning --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1b12a17ae71e..193ae4ba7578 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,8 +9,8 @@ node { checkoutGit() terraformAutoImageVersion = '1.0.2' baseTerraformAutoImage = "docker-production-iac/iac/tf-plugin-builder:${terraformAutoImageVersion}" - baseVersion = 'v1.0' - newVersion = newVersion(baseVersion) + '-amadeus' + baseVersion = '1.0' + newVersion = newVersion(baseVersion) registry = 'repository.adp.amadeus.net' baseImage = 'maven:3.6.3-jdk-11' // pageId for https://rndwww.nce.amadeus.net/confluence/display/IBSDC/IaC+Release+Notes From 68dd0891b414c85f4c7bae1f071f73806a0f7e6d Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Fri, 21 Oct 2022 16:15:25 +0200 Subject: [PATCH 14/18] SACP-47873: Removing .terraformrc file & limiting parallel tests --- Jenkinsfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 193ae4ba7578..9c5d3f632723 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ /* groovylint-disable-next-line CompileStatic, NoDef, UnusedVariable, VariableName, VariableTypeRequired */ @Library(['pipeline-toolbox', 'iac-pipeline-shared-lib']) _ -node { +node('large') { try { stage('Setup') { artifactName = env.BITBUCKET_REPOSITORY @@ -35,7 +35,7 @@ node { #not running acceptance tests now #make testacc echo -e "credentials \\"$MUC_REGISTRY_HOST\\" {\n token = \\"$MUC_ARTIFACTORY_TOKEN\\"\n}\n" > .terraformrc - goreleaser release --snapshot --rm-dist --config .goreleaser-jenkins.yml --parallelism=2 + goreleaser release --snapshot --rm-dist --config .goreleaser-jenkins.yml ''' } } @@ -61,8 +61,7 @@ node { docker.image(baseTerraformAutoImage).inside { /* groovylint-disable-next-line GStringExpressionWithinString */ sh ''' - echo -e "credentials \\"$MUC_REGISTRY_HOST\\" {\n token = \\"$MUC_ARTIFACTORY_TOKEN\\"\n}\n" > .terraformrc - goreleaser release --rm-dist --config .goreleaser-jenkins.yml --parallelism=2 + goreleaser release --rm-dist --config .goreleaser-jenkins.yml ''' } } From 14ebf7133ca8b5f6f10bb8f1b92c4ee37d84b590 Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Fri, 21 Oct 2022 16:36:18 +0200 Subject: [PATCH 15/18] SACP-47873: Limiting parallel builds to 5 --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9c5d3f632723..b942047d99b9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ node('large') { #not running acceptance tests now #make testacc echo -e "credentials \\"$MUC_REGISTRY_HOST\\" {\n token = \\"$MUC_ARTIFACTORY_TOKEN\\"\n}\n" > .terraformrc - goreleaser release --snapshot --rm-dist --config .goreleaser-jenkins.yml + goreleaser release --snapshot --rm-dist --config .goreleaser-jenkins.yml --parallelism=5 ''' } } @@ -61,7 +61,7 @@ node('large') { docker.image(baseTerraformAutoImage).inside { /* groovylint-disable-next-line GStringExpressionWithinString */ sh ''' - goreleaser release --rm-dist --config .goreleaser-jenkins.yml + goreleaser release --rm-dist --config .goreleaser-jenkins.yml --parallelism=5 ''' } } From 8ef20ab8515d3ccb45557aea51dfab5e31e6be3f Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Fri, 21 Oct 2022 18:08:33 +0200 Subject: [PATCH 16/18] SACP-47877: Rolling Upgrade cancelled before deleting VMSS --- internal/services/compute/client/helper.go | 29 +++++++++++++++++++ ...inux_virtual_machine_scale_set_resource.go | 7 +++++ ...al_machine_scale_set_extension_resource.go | 7 +++++ ...dows_virtual_machine_scale_set_resource.go | 7 +++++ 4 files changed, 50 insertions(+) create mode 100644 internal/services/compute/client/helper.go diff --git a/internal/services/compute/client/helper.go b/internal/services/compute/client/helper.go new file mode 100644 index 000000000000..2383accda84a --- /dev/null +++ b/internal/services/compute/client/helper.go @@ -0,0 +1,29 @@ +package client + +import ( + "context" + "fmt" + "log" + "net/http" + "strings" +) + +func (c *Client) CancelRollingUpgradesBeforeDeletion(ctx context.Context, resourceGroupName string, vmScaleSetName string) error { + future, err := c.VMScaleSetRollingUpgradesClient.Cancel(ctx, resourceGroupName, vmScaleSetName) + + // If rolling upgrades haven't been run (when VMSS are just provisioned with rolling upgrades but no extensions, auto-scaling are run ) + // we can not cancel rolling upgrades + // API call :: GET https://management.azure.com/subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmSSName}/rollingUpgrades/latest?api-version=2021-07-01 + // Azure API throws 409 conflict error saying "The entity was not found in this Azure location." + // If the above error message matches, we identify and move forward to delete the VMSS + // in all other cases, it just cancels the rolling upgrades and move ahead to delete the VMSS + if err != nil && !(future.Response().StatusCode == http.StatusConflict && strings.Contains(err.Error(), "There is no ongoing Rolling Upgrade to cancel.")) { + return fmt.Errorf("error cancelling rolling upgrades of Virtual Machine Scale Set %q (Resource Group %q): %+v", vmScaleSetName, resourceGroupName, err) + } + + if err := future.WaitForCompletionRef(ctx, c.VMScaleSetExtensionsClient.Client); err != nil && !(future.Response().StatusCode == http.StatusConflict && strings.Contains(err.Error(), "There is no ongoing Rolling Upgrade to cancel.")) { + return fmt.Errorf("waiting for cancelling rolling upgrades of Virtual Machine Scale Set %q (Resource Group %q): %+v", vmScaleSetName, resourceGroupName, err) + } + log.Printf("[DEBUG] cancelled Virtual Machine Scale Set Rolling Upgrades %q (Resource Group %q).", vmScaleSetName, resourceGroupName) + return nil +} diff --git a/internal/services/compute/linux_virtual_machine_scale_set_resource.go b/internal/services/compute/linux_virtual_machine_scale_set_resource.go index ce571516e36e..e1717a2a3246 100644 --- a/internal/services/compute/linux_virtual_machine_scale_set_resource.go +++ b/internal/services/compute/linux_virtual_machine_scale_set_resource.go @@ -1078,6 +1078,13 @@ func resourceLinuxVirtualMachineScaleSetDelete(d *pluginsdk.ResourceData, meta i return fmt.Errorf("retrieving Linux Virtual Machine Scale Set %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) } + // When rolling upgrades are setup, vmscalesets can't be deleted unless the upgrade is cancelled. + // Since destroy function intention is to VMSS itself. Rolling upgrades are trivial here, hence we cancel before we trigger destroy call + err = meta.(*clients.Client).Compute.CancelRollingUpgradesBeforeDeletion(ctx, id.ResourceGroup, id.Name) + if err != nil { + return fmt.Errorf("error while cancelling rolling upgrade during destroy phase in Linux Virtual Machine Scale Set %q (Resource Group %q) : %+v", id.Name, id.ResourceGroup, err) + } + // Sometimes VMSS's aren't fully deleted when the `Delete` call returns - as such we'll try to scale the cluster // to 0 nodes first, then delete the cluster - which should ensure there's no Network Interfaces kicking around // and work around this Azure API bug: diff --git a/internal/services/compute/virtual_machine_scale_set_extension_resource.go b/internal/services/compute/virtual_machine_scale_set_extension_resource.go index 3941161d1c5b..8e491421e743 100644 --- a/internal/services/compute/virtual_machine_scale_set_extension_resource.go +++ b/internal/services/compute/virtual_machine_scale_set_extension_resource.go @@ -361,6 +361,13 @@ func resourceVirtualMachineScaleSetExtensionDelete(d *pluginsdk.ResourceData, me return err } + // When rolling upgrades are setup, vmscalesets can't be deleted unless the upgrade is cancelled. + // Since destroy function intention is to VMSS itself. Rolling upgrades are trivial here, hence we cancel before we trigger destroy call + err = meta.(*clients.Client).Compute.CancelRollingUpgradesBeforeDeletion(ctx, id.ResourceGroup, id.VirtualMachineScaleSetName) + if err != nil { + return fmt.Errorf("error while cancelling rolling upgrade during destroy phase in Linux Virtual Machine Scale Set %q (Resource Group %q) : %+v", id.VirtualMachineScaleSetName, id.ResourceGroup, err) + } + future, err := client.Delete(ctx, id.ResourceGroup, id.VirtualMachineScaleSetName, id.ExtensionName) if err != nil { return fmt.Errorf("deleting Extension %q (Virtual Machine Scale Set %q / Resource Group %q): %+v", id.ExtensionName, id.VirtualMachineScaleSetName, id.ResourceGroup, err) diff --git a/internal/services/compute/windows_virtual_machine_scale_set_resource.go b/internal/services/compute/windows_virtual_machine_scale_set_resource.go index e83fcecf085a..f3608ce6eb64 100644 --- a/internal/services/compute/windows_virtual_machine_scale_set_resource.go +++ b/internal/services/compute/windows_virtual_machine_scale_set_resource.go @@ -1108,6 +1108,13 @@ func resourceWindowsVirtualMachineScaleSetDelete(d *pluginsdk.ResourceData, meta return fmt.Errorf("retrieving Windows Virtual Machine Scale Set %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) } + // When rolling upgrades are setup, vmscalesets can't be deleted unless the upgrade is cancelled. + // Since destroy function intention is to VMSS itself. Rolling upgrades are trivial here, hence we cancel before we trigger destroy call + err = meta.(*clients.Client).Compute.CancelRollingUpgradesBeforeDeletion(ctx, id.ResourceGroup, id.Name) + if err != nil { + return fmt.Errorf("error while cancelling rolling upgrade during destroy phase in Linux Virtual Machine Scale Set %q (Resource Group %q) : %+v", id.Name, id.ResourceGroup, err) + } + // Sometimes VMSS's aren't fully deleted when the `Delete` call returns - as such we'll try to scale the cluster // to 0 nodes first, then delete the cluster - which should ensure there's no Network Interfaces kicking around // and work around this Azure API bug: From 8e7ddd33c018bd7feedb10326de5e0feff7cad08 Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 25 Oct 2022 17:14:20 +0200 Subject: [PATCH 17/18] pushing changes to github branch --- .goreleaser-jenkins.yml | 78 ----------------------------------------- Jenkinsfile | 77 ---------------------------------------- 2 files changed, 155 deletions(-) delete mode 100644 .goreleaser-jenkins.yml delete mode 100644 Jenkinsfile diff --git a/.goreleaser-jenkins.yml b/.goreleaser-jenkins.yml deleted file mode 100644 index 5d7448a01ff8..000000000000 --- a/.goreleaser-jenkins.yml +++ /dev/null @@ -1,78 +0,0 @@ -# Visit https://goreleaser.com for documentation on how to customize this -# behavior. -before: - hooks: - # this is just an example and not a requirement for provider building/publishing - - go mod tidy -dist: dist2/ -builds: -- env: - # goreleaser does not work with CGO, it could also complicate - # usage by users in CI/CD systems like Terraform Cloud where - # they are unable to install libraries. - - CGO_ENABLED=0 - mod_timestamp: '{{ .CommitTimestamp }}' - flags: - - -trimpath - ldflags: - - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' - goos: - - freebsd - - windows - - linux - - darwin - goarch: - - amd64 - - '386' - - arm - - arm64 - binary: '{{ .ProjectName }}_v{{ .Version }}_x4' -archives: -- format: zip - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' -checksum: - name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' - algorithm: sha256 -signs: - - artifacts: checksum - args: - # if you are using this in a GitHub action or some other automated pipeline, you - # need to pass the batch flag to indicate its not interactive. - - "--batch" - - "--local-user" - - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key - - "--output" - - "${signature}" - - "--detach-sign" - - "${artifact}" - -artifactories: - - name: production - target: https://repository.rnd.amadeus.net/artifactory/generic-production-iac/providers/azurerm/{{ .ProjectName }}/{{ .Version }}/ - #target: http://:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/ - # Upload checksums (defaults to false) - checksum: true - # Upload signatures (defaults to false) - signature: true - -publishers: - - name: Generate and Publish provider metadata - cmd: >- - tf-provider-registry-api-generator - --bucket-name 'generic-production-iac' - --terraform-provider '{{ .ProjectName }}' - --namespace 'amadeus' - --fingerprint '{{ .Env.GPG_FINGERPRINT }}' - --provider-version {{ .Tag }} - env: - - "PATH={{ .Env.PATH }}" - - "MUC_ARTIFACTORY_TOKEN={{ .Env.MUC_ARTIFACTORY_TOKEN }}" - - "RND_ARTIFACTORY_TOKEN={{ .Env.RND_ARTIFACTORY_TOKEN }}" - -release: - # to disable automatic push to github as we use artifactory - disable: true - # If you want to manually examine the release before its live, uncomment this line: - # draft: true -changelog: - skip: true \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index b942047d99b9..000000000000 --- a/Jenkinsfile +++ /dev/null @@ -1,77 +0,0 @@ -/* groovylint-disable DuplicateMapLiteral, LineLength */ -/* groovylint-disable-next-line CompileStatic, NoDef, UnusedVariable, VariableName, VariableTypeRequired */ -@Library(['pipeline-toolbox', 'iac-pipeline-shared-lib']) _ - -node('large') { - try { - stage('Setup') { - artifactName = env.BITBUCKET_REPOSITORY - checkoutGit() - terraformAutoImageVersion = '1.0.2' - baseTerraformAutoImage = "docker-production-iac/iac/tf-plugin-builder:${terraformAutoImageVersion}" - baseVersion = '1.0' - newVersion = newVersion(baseVersion) - registry = 'repository.adp.amadeus.net' - baseImage = 'maven:3.6.3-jdk-11' - // pageId for https://rndwww.nce.amadeus.net/confluence/display/IBSDC/IaC+Release+Notes - //releaseNotesOptions = ['spaceKey': 'IBSDC', 'parentPageId': 1654937615] - } - - stage('QA tests and goreleaser to release locally (not pushing to artifactory yet)') { - /* groovylint-disable-next-line UnnecessaryGetter */ - when(isPullRequest()) { - docker.withRegistry("https://${registry}") { - /* groovylint-disable-next-line NestedBlockDepth */ - docker.image(baseTerraformAutoImage).inside { - withCredentials([ - usernamePassword(credentialsId: 'goreleaser-artifactory-creds', usernameVariable: 'ARTIFACTORY_PRODUCTION_USERNAME', passwordVariable: 'ARTIFACTORY_PRODUCTION_SECRET'), - usernamePassword(credentialsId: 'RND-ARTIFACTORY-TOKEN', usernameVariable: 'RND_ARTIFACTORY_USER', passwordVariable: 'RND_ARTIFACTORY_TOKEN'), - usernamePassword(credentialsId: 'MUC_ARTIFACTORY_REGISTRY_TOKEN', usernameVariable: 'MUC_REGISTRY_HOST', passwordVariable: 'MUC_ARTIFACTORY_TOKEN') - /* groovylint-disable-next-line NestedBlockDepth */ - ]) { - sh ''' - make fmtcheck - make test - #not running acceptance tests now - #make testacc - echo -e "credentials \\"$MUC_REGISTRY_HOST\\" {\n token = \\"$MUC_ARTIFACTORY_TOKEN\\"\n}\n" > .terraformrc - goreleaser release --snapshot --rm-dist --config .goreleaser-jenkins.yml --parallelism=5 - ''' - } - } - } - } - } - - stage('Increment Tag && gorelease to artifactory') { - withCredentials([ - /* groovylint-disable-next-line DuplicateStringLiteral */ - usernamePassword(credentialsId: 'goreleaser-artifactory-creds', usernameVariable: 'ARTIFACTORY_PRODUCTION_USERNAME', passwordVariable: 'ARTIFACTORY_PRODUCTION_SECRET'), - /* groovylint-disable-next-line DuplicateStringLiteral */ - usernamePassword(credentialsId: 'RND-ARTIFACTORY-TOKEN', usernameVariable: 'RND_ARTIFACTORY_USER', passwordVariable: 'RND_ARTIFACTORY_TOKEN'), - /* groovylint-disable-next-line DuplicateStringLiteral */ - usernamePassword(credentialsId: 'MUC_ARTIFACTORY_REGISTRY_TOKEN', usernameVariable: 'MUC_REGISTRY_HOST', passwordVariable: 'MUC_ARTIFACTORY_TOKEN') - ]) { - /* groovylint-disable-next-line UnnecessaryGetter */ - when(env.BRANCH_NAME == 'master' || isReleasedBranch()) { - pushNewVersionTag(newVersion, baseVersion, releaseNotesOptions) - /* groovylint-disable-next-line DuplicateStringLiteral, NestedBlockDepth */ - docker.withRegistry("https://${registry}") { - /* groovylint-disable-next-line NestedBlockDepth */ - docker.image(baseTerraformAutoImage).inside { - /* groovylint-disable-next-line GStringExpressionWithinString */ - sh ''' - goreleaser release --rm-dist --config .goreleaser-jenkins.yml --parallelism=5 - ''' - } - } - } - } - } - } catch (err) { - echo "Caught: ${err}" - currentBuild.result = 'FAILURE' - } finally { - echo 'Done' - } -} From e14adc0b5d66a539c2d3b03d76a55bac584abb6f Mon Sep 17 00:00:00 2001 From: Harshavardhan Musanalli Date: Tue, 25 Oct 2022 17:20:23 +0200 Subject: [PATCH 18/18] reverting changes to .goreleaser.yml --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index b928fd22300f..3e1157c789c0 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -71,4 +71,4 @@ signs: id: key-id signature: ${artifact}.72D7468F.sig snapshot: - name_template: "{{ .Tag }}-next" \ No newline at end of file + name_template: "{{ .Tag }}-next"