diff --git a/.ci/jobs/defaults.yml b/.ci/jobs/defaults.yml new file mode 100644 index 000000000..93e141c75 --- /dev/null +++ b/.ci/jobs/defaults.yml @@ -0,0 +1,38 @@ +--- +##### GLOBAL METADATA + +- meta: + cluster: devops-ci + +##### JOB DEFAULTS + +- job: + project-type: pipeline + logrotate: + daysToKeep: 30 + numToKeep: 100 + artifactDaysToKeep: 5 + artifactNumToKeep: 10 + parameters: + - string: + name: branch_specifier + default: refs/heads/main + description: "the Git branch specifier to build (<branchName>, <tagName>,<commitId>, etc.)" + properties: + - github: + url: https://github.com/elastic/terraform-provider-elasticstack + - inject: + properties-content: HOME=$JENKINS_HOME + pipeline-scm: + script-path: .ci/pipelines/acceptance.groovy + scm: + - git: + credentials-id: "f6c7695a-671e-4f4f-a331-acdce44ff9ba" + reference-repo: /var/lib/jenkins/.git-references/terraform-provider-elasticstack.git + branches: + - ${branch_specifier} + url: https://github.com/elastic/terraform-provider-elasticstack + vault: [] + wrappers: + - ansicolor + - timestamps diff --git a/.ci/jobs/elastic+terraform-provider-elasticstack+main.yml b/.ci/jobs/elastic+terraform-provider-elasticstack+main.yml new file mode 100644 index 000000000..bdf97f9bd --- /dev/null +++ b/.ci/jobs/elastic+terraform-provider-elasticstack+main.yml @@ -0,0 +1,12 @@ +--- +- job: + name: elastic+terraform-provider-elasticstack+main + display-name: elastic / terraform-provider-elasticstack - main + description: Main branch testing + triggers: + - github + pipeline-scm: + scm: + - git: + branches: + - main diff --git a/.ci/jobs/elastic+terraform-provider-elasticstack+pull-request.yml b/.ci/jobs/elastic+terraform-provider-elasticstack+pull-request.yml new file mode 100644 index 000000000..2abdc63b0 --- /dev/null +++ b/.ci/jobs/elastic+terraform-provider-elasticstack+pull-request.yml @@ -0,0 +1,20 @@ +--- +- job: + name: elastic+terraform-provider-elasticstack+pull-request + display-name: elastic / terraform-provider-elasticstack - pull-request + description: Pull request testing + concurrent: true + triggers: + - github-pull-request: + github-hooks: true + org-list: + - elastic + allow-whitelist-orgs-as-admins: true + cancel-builds-on-update: false + status-context: acceptance + pipeline-scm: + scm: + - git: + branches: + - $ghprbActualCommit + refspec: +refs/pull/*:refs/remotes/origin/pr/* diff --git a/.ci/pipelines/acceptance.groovy b/.ci/pipelines/acceptance.groovy new file mode 100644 index 000000000..2e4311205 --- /dev/null +++ b/.ci/pipelines/acceptance.groovy @@ -0,0 +1,38 @@ +@Library('estc') _ + +pipeline { + agent { label('linux && immutable && docker') } + + environment { + HOME = "${env.JENKINS_HOME}" + REPOSITORY = "terraform-provider-elasticstack" + GIT_REFERENCE_REPO = "/var/lib/jenkins/.git-references/terraform-provider-elasticstack.git" + GIT_CREDENTIALS = "f6c7695a-671e-4f4f-a331-acdce44ff9ba" + } + + stages { + stage('Checkout') { + options { skipDefaultCheckout() } + steps { + estcGithubCheckout(github_org: 'elastic', + repository: env.REPOSITORY, + revision: env.ghprbActualCommit ?: env.CHANGE_BRANCH ?: env.BRANCH_NAME ?: params.branch_specifier, + reference_repo: env.GIT_REFERENCE_REPO, + credentials: env.GIT_CREDENTIALS) + } + } + + stage('Acceptance Tests') { + steps { + script { + dir('.') { + sh '''#!/bin/bash + + make docker-testacc + ''' + } + } + } + } + } +}