Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): support building docker images for PRs #20323

Merged
merged 2 commits into from
Jul 29, 2020

Conversation

mdelapenya
Copy link
Contributor

What does this PR do?

It uses the PR ID as the new name for the docker images built by the packaging build. This change will only apply to PRs. For any other type of build (merge, branch), the previous behavior will be kept.

Why is it important?

We want to generate images for the PRs, without overriding the current snapshot for releases. This way we will be able to consume those images for PRs in other projects, such as the e2e tests for Ingest Manager or integrations.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

Use cases

Scenario: a PR generates its own docker images without overridding the snapshot ones for merge-commits
Given a PR
When the author requests packaging it
Then the docker images are pushed to the observability-ci namespace including the pr ID on its name
   And the snapshot is not overridden

@mdelapenya mdelapenya self-assigned this Jul 29, 2020
@mdelapenya mdelapenya requested a review from a team July 29, 2020 15:54
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 29, 2020
@mdelapenya mdelapenya added the Team:Automation Label for the Observability productivity team label Jul 29, 2020
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 29, 2020
@mdelapenya mdelapenya marked this pull request as ready for review July 29, 2020 15:56
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 29, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #20323 updated]

  • Start Time: 2020-07-29T16:44:09.252+0000

  • Duration: 24 min 47 sec


def imageName = "${name}"
if (env.CHANGE_ID?.trim()) {
imageName = "${name}/pr-${env.CHANGE_ID}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the image will have a mane like docker.elastic.co/observability-ci/filebeat/pr-1000:a2b3a2b3bb12b2b1212b2 for me is weird, I'd like to release docker.elastic.co/observability-ci/filebeat:a2b3a2b3bb12b2b1212b2 and docker.elastic.co/observability-ci/filebeat:pr-1000

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I sent a commit with this change, as I see it more convenient too

.ci/packaging.groovy Outdated Show resolved Hide resolved
def oldName = "${DOCKER_REGISTRY}/beats/${name}:${libbetaVer}"
def newName = "${DOCKER_REGISTRY}/observability-ci/${name}:${libbetaVer}"
def newName = "${DOCKER_REGISTRY}/observability-ci/${name}:${tagName}"
def commitName = "${DOCKER_REGISTRY}/observability-ci/${name}:${env.GIT_BASE_COMMIT}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are keeping the tag with the commit

@mdelapenya mdelapenya merged commit ea63f05 into elastic:master Jul 29, 2020
v1v added a commit to v1v/beats that referenced this pull request Jul 30, 2020
…ne-2.0

* upstream/master: (29 commits)
  Add an explicit system test for processes on unix systems (elastic#20320)
  [Autodiscovery] Ignore ErrInputNotFinished errors in autodiscover config checks (elastic#20305)
  [CI] Update README.md with CI references (elastic#20316)
  Add ECK doc links to Heartbeat docs (elastic#20284)
  [Filebeat] Add export tests to x-pack/filebeat (elastic#20156)
  feat(ci): support building docker images for PRs (elastic#20323)
  Update system tests dependency (elastic#20287)
  [Libbeat] Log debug message if the Kibana dashboard can not be imported from the archive (elastic#12211) (elastic#20150)
  [Filebeat][Gsuite] Transform all dates to timestamp with processor (elastic#20308)
  Infer types in Prometheus remote_write (elastic#19944)
  Remove unnecessary restarts of metricsets while using Node autodiscover (elastic#19974)
  docs: update changelog on master branch (elastic#20259)
  feat(ci): support storing artifacts for PRs in separate dirs (elastic#20282)
  [CI] Change upstream reference (elastic#20296)
  [Filebeat] Updates to Suricata module (elastic#20220)
  [docs] Fix Windows download link for agent (elastic#20258)
  [docs] Rename release highlights to what's new (elastic#20255)
  fix: update the display name of the multibranch job (elastic#20265)
  [Elastic Agent] Add basic protocol to control Elastic Agent. (elastic#20146)
  Cisco ASA: Fix message 106100 (elastic#20245)
  ...
@mdelapenya mdelapenya deleted the 20317-docker-images-for-prs branch August 3, 2020 07:32
mdelapenya added a commit to mdelapenya/beats that referenced this pull request Aug 6, 2020
* feat(ci): support building docker images for PRs

* chore: use PR_ID as tag
mdelapenya added a commit to mdelapenya/beats that referenced this pull request Aug 6, 2020
* feat(ci): support building docker images for PRs

* chore: use PR_ID as tag
mdelapenya added a commit that referenced this pull request Aug 11, 2020
…20323) (#20468)

* feat(ci): support building docker images for PRs (#20323)

* feat(ci): support building docker images for PRs

* chore: use PR_ID as tag

* chore(ci): use build step for checking if is PR

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
mdelapenya added a commit that referenced this pull request Aug 11, 2020
…20323) (#20467)

* feat(ci): support building docker images for PRs (#20323)

* feat(ci): support building docker images for PRs

* chore: use PR_ID as tag

* chore(ci): use build step for checking if is PR
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
* feat(ci): support building docker images for PRs

* chore: use PR_ID as tag
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…lastic#20323) (elastic#20467)

* feat(ci): support building docker images for PRs (elastic#20323)

* feat(ci): support building docker images for PRs

* chore: use PR_ID as tag

* chore(ci): use build step for checking if is PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Automation Label for the Observability productivity team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support PRs to use PR ID in the docker images pushed to our docker registry
5 participants