-
Notifications
You must be signed in to change notification settings - Fork 82
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
Introduce OCI artifacts signatures #296
Merged
poiana
merged 11 commits into
falcosecurity:master
from
maxgio92:feat/registry-print-status
Jul 10, 2023
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
df0f819
new(build/registry): add support for oci artifact metadata
maxgio92 e5225d2
refactor(build/registry/pkg/registry): add push metadata list type
maxgio92 fe18cdf
test(build/registry): add push metadata printing unit tests
maxgio92 20ae697
refactor(build/registry): delegate presentation to command
maxgio92 9381234
ci(upload-oci-artifacts): print registry update status
maxgio92 3738986
chore(build/registry): add license headers
maxgio92 48c224f
refactor(build/registry): add support for context with options
maxgio92 ee8b2b3
ci: create and publish artifact signatures with cosign
maxgio92 6ba35d8
login to ghcr before signing
LucaGuerra 1f4e1f5
remove error for empty matrix
LucaGuerra dd6f1f3
chore(.github/workflows/upload-oci-artifacts): remove print
maxgio92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ jobs: | |
publish-oci-artifacts: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
matrix: ${{ steps.oci_build.outputs.REGISTRY_UPDATE_STATUS }} | ||
|
||
steps: | ||
- name: Checkout Plugins | ||
uses: actions/checkout@v3 | ||
|
@@ -22,10 +25,47 @@ jobs: | |
run: make | ||
|
||
- name: Upload OCI artifacts to GitHub packages | ||
id: oci_build | ||
env: | ||
REGISTRY: ghcr.io | ||
REGISTRY_USER: ${{ github.repository_owner }} | ||
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
REPO_GITHUB: https://github.com/${{ github.repository_owner }}/plugins.git | ||
working-directory: build/registry | ||
run: ./bin/registry update-oci-registry ../../registry.yaml | ||
run: >- | ||
echo "REGISTRY_UPDATE_STATUS=$( | ||
./bin/registry update-oci-registry ../../registry.yaml | ||
)" >> $GITHUB_OUTPUT | ||
|
||
# Create signatures of the plugin artifacts as OCI artifacts | ||
sign-oci-artifacts: | ||
needs: [ publish-oci-artifacts ] | ||
runs-on: ubuntu-latest | ||
|
||
if: ${{ needs.publish-oci-artifacts.outputs.matrix != '[]' }} | ||
strategy: | ||
matrix: | ||
value: ${{ fromJson(needs.publish-oci-artifacts.outputs.matrix) }} | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
packages: write | ||
|
||
steps: | ||
- name: Install Cosign | ||
uses: sigstore/[email protected] | ||
with: | ||
cosign-release: 'v2.1.0' | ||
- run: cosign version | ||
|
||
- name: Log into ghcr.io | ||
uses: docker/login-action@master | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Sign the artifacts with GitHub OIDC Token | ||
run: cosign sign --yes ${{ matrix.value.repository.ref }}@${{ matrix.value.artifact.digest }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
Copyright (C) 2022 The Falco Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package options | ||
|
||
import ( | ||
"context" | ||
"io" | ||
) | ||
|
||
type CommonOptions struct { | ||
Output io.Writer | ||
Context context.Context | ||
} | ||
|
||
type CommonOption func(opts *CommonOptions) | ||
|
||
func NewCommonOptions(opts ...CommonOption) *CommonOptions { | ||
o := &CommonOptions{} | ||
|
||
for _, f := range opts { | ||
f(o) | ||
} | ||
|
||
return o | ||
} | ||
|
||
func WithOutput(out io.Writer) CommonOption { | ||
return func(opts *CommonOptions) { | ||
opts.Output = out | ||
} | ||
} | ||
|
||
func WithContext(ctx context.Context) CommonOption { | ||
return func(opts *CommonOptions) { | ||
opts.Context = ctx | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 is awesome 🤩