-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Migrate from CircleCI to GitHub Actions #1351
base: master
Are you sure you want to change the base?
Migrate from CircleCI to GitHub Actions #1351
Conversation
d809638
to
dd02a2a
Compare
|
||
publish_release: | ||
name: Publish release | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v0.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will break when we go to 1.x.x release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@electron0zero
Is it enough to add an OR where we also check if the tag starts with "v1." too?
Unfortunately, regex is not a part of the functions in GitHub Actions so we are stuck with checking the start, which is why I assume that Prometheus also does this using this method:
It seems like it would be very hacky to try to work around this limitation of Actions to avoid a problem that is very easy to solve (just adding the relevant version prefix).
|
||
build_all: | ||
name: Build all architectures | ||
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v0.')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, this will also break with v1.x.x release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous response.
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Read .promu.yml | ||
uses: pietrobolcato/action-read-yaml@dd664040f4883322f6d143e58302062b35a46e4d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if possible, we would like to avoid using third party actions, and would prefer to only use actions from actions
and prometheus
orgs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see any actions from actions
or prometheus
that would allow this.
Prometheus kindly asks and hopes that people remember to update the .promu.yml to match the Go version:
This seems more flimsy to me than directly pointing to a specific commit of a third-party that can just pull the go version from the .promu.yml file for us.
If you disagree, I can add a comment similar to Prometheus and hardcode the Go version, just thought this was better in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like do this the way Prometheus does for consistency across repos in Prometheus org, we already have a similar comment for circleci.
Line 2 in 7d61fee
# Whenever the Go version is updated here, .circle/config.yml should also be updated. |
- run: make build | ||
- run: make test GOOPTS=-v | ||
|
||
build_common: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reasons to split the build into build_common
and build
steps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to build "common" architectures when someone submits a PR so reviewers can download the binary and test things quickly.
This was inspired from Prometheus's implementation where they appear to do the same thing:
Then when there is a release or merge to main, all the architectures are built.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I okay with the split, but let's add this info as a comment as also link to Prometheus so we document the reason on why why we split the build.
Signed-off-by: Bryce-Souers <[email protected]>
Signed-off-by: Bryce-Souers <[email protected]>
cde6aa0
to
79d6c8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at YACE's CI.
This is a working example of Prometheus actions CI for an exporter.
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be pinned to commit hash for supply chain security.
uses: actions/[email protected] | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
FYI, I have updated the Org shared secrets to included the required ENV vars for publishing. |
This is in response to Issue #1341 "Move from Circle CI to Github Actions".
I took heavy inspiration from the Prometheus implementation here:
https://github.com/prometheus/prometheus/blob/main/.github/workflows/ci.yml
Implementation notes
New secrets are required
You must add the following secrets to be used in the ci.yml GitHub Action:
https://github.com/prometheus/blackbox_exporter/settings/secrets/actions
For my testing, I had to create my own secrets in my forked repository.
Removing skipped tests
In this pull request, I removed all skipped tests that were skipped due to "CI" and validated that they work fine.
Adding skip to TestChooseProtocol
As was called out in #1341, IPv6-related issues were ran into but they appeared to only fail TestChooseProtocol for Windows.
I have adjusted the test to be skipped accordingly under those conditions.
I feel this is fine as we are testing on 2 other OS's.
Testing
In order to test this, I forked the repository and made many commits to my master branch (as that's the branch that I had to apply Actions configurations to for GitHub to pick them up).
Here are the results, laid out by what condition was tested and what the outcome was:
Condition
Create new branch and publish to remote with changes.
Outcome
1 Github Action was triggered and it ran the
Test
job.Condition
Create pull request of new branch to master.
Outcome
1 Github Action was triggered and it ran the
Test
andBuild common architectures
jobs.Condition
Push change / merge pull request into master.
Outcome
1 GitHub Action was triggered and it ran the
Test
,Build all architectures
, andPublish master
jobs.DockerHub’s master tag was updated.
Quay’s master tag was updated.
Condition
A release PR is created and merged into master.
A tag for v0.30.0 is created:
Outcome
1 GitHub Action was triggered, and it ran the
Test
,Build all architectures
, andPublish release
jobs.A release for v0.30.0 was created.
DockerHub’s master tag was updated.
Quay’s master tag was updated.