-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
twoliter: create initial project with kits
- Loading branch information
Showing
32 changed files
with
432 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/.git | ||
/.gomodcache | ||
/build/* | ||
!/build/rpms/ | ||
/build/rpms/* | ||
!/build/rpms/*.rpm | ||
/build/rpms/*-debuginfo-*.rpm | ||
/build/rpms/*-debugsource-*.rpm | ||
**/target/* | ||
/sbkeys |
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,10 @@ | ||
/build/ | ||
**/target/ | ||
/.cargo/ | ||
/.gomodcache/ | ||
/keys/ | ||
/roles/ | ||
/sbkeys/ | ||
Test.toml | ||
testsys.kubeconfig | ||
Infra.toml |
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 @@ | ||
This project represents a project structure with a single local kit with no external kit dependencies. |
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 @@ | ||
version = "0.0.1" |
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,11 @@ | ||
schema-version = 1 | ||
|
||
[sdk] | ||
registry = "twoliter.alpha" | ||
name = "bottlerocket-sdk" | ||
version = "latest" | ||
|
||
[toolchain] | ||
registry = "public.ecr.aws/bottlerocket" | ||
name = "bottlerocket-toolchain" | ||
version = "v0.34.1" |
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,9 @@ | ||
use std::process::{exit, Command}; | ||
|
||
fn main() -> Result<(), std::io::Error> { | ||
let ret = Command::new("buildsys").arg("build-variant").status()?; | ||
if !ret.success() { | ||
exit(1); | ||
} | ||
Ok(()) | ||
} |
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,22 @@ | ||
[package] | ||
name = "hello-kit" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
build = "../build.rs" | ||
# Don't rebuild crate just because of changes to README. | ||
exclude = ["README.md"] | ||
|
||
[package.metadata.build-kit] | ||
included-packages = [ | ||
# in-tree packages | ||
"hello-agent", | ||
"hello-go", | ||
] | ||
|
||
[lib] | ||
path = "../kits.rs" | ||
|
||
[build-dependencies] | ||
hello-agent = { path = "../../packages/hello-agent" } | ||
hello-go = { path = "../../packages/hello-go" } |
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,7 @@ | ||
/*! | ||
This is an intentionally empty file that all of the variant `Cargo.toml` files can point to as their | ||
`lib.rs`. The build system uses `build.rs` to invoke `buildsys` but Cargo needs something to compile | ||
so we give it an empty `lib.rs` file. | ||
!*/ |
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,9 @@ | ||
use std::process::{exit, Command}; | ||
|
||
fn main() -> Result<(), std::io::Error> { | ||
let ret = Command::new("buildsys").arg("build-package").status()?; | ||
if !ret.success() { | ||
exit(1); | ||
} | ||
Ok(()) | ||
} |
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,21 @@ | ||
[package] | ||
name = "hello-agent" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
build = "../build.rs" | ||
|
||
[package.metadata.build-package] | ||
variant-sensitive = false | ||
source-groups = ["hello-agent"] | ||
|
||
[lib] | ||
path = "../packages.rs" | ||
|
||
# RPM BuildRequires | ||
[build-dependencies] | ||
# None | ||
|
||
# RPM Requires | ||
[dependencies] | ||
# None |
9 changes: 9 additions & 0 deletions
9
tests/projects/local-kit/packages/hello-agent/hello-agent.service
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,9 @@ | ||
[Unit] | ||
Description=Send a hello-agent Ping | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=false | ||
StandardError=journal+console | ||
ExecStart=/usr/bin/hello-agent | ||
TimeoutStartSec=30s |
44 changes: 44 additions & 0 deletions
44
tests/projects/local-kit/packages/hello-agent/hello-agent.spec
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,44 @@ | ||
%global _cross_first_party 1 | ||
%undefine _debugsource_packages | ||
|
||
Name: %{_cross_os}hello-agent | ||
Version: 0.0 | ||
Release: 0%{?dist} | ||
Summary: Hello-agent | ||
License: Apache-2.0 OR MIT | ||
URL: https://github.com/bottlerocket-os/bottlerocket | ||
|
||
# sources < 100: misc | ||
|
||
# 1xx sources: systemd units | ||
Source103: hello-agent.service | ||
Source104: hello-agent.timer | ||
|
||
BuildRequires: %{_cross_os}glibc-devel | ||
|
||
%description | ||
%{summary}. | ||
|
||
%prep | ||
%setup -T -c | ||
%cargo_prep | ||
|
||
%build | ||
mkdir bin | ||
|
||
%cargo_build_static --manifest-path %{_builddir}/sources/Cargo.toml \ | ||
-p hello-agent | ||
|
||
%install | ||
install -d %{buildroot}%{_cross_bindir} | ||
install -p -m 0755 ${HOME}/.cache/.static/%{__cargo_target_static}/release/hello-agent %{buildroot}%{_cross_bindir} | ||
|
||
install -d %{buildroot}%{_cross_unitdir} | ||
install -p -m 0644 \ | ||
%{S:103} %{S:104} \ | ||
%{buildroot}%{_cross_unitdir} | ||
|
||
%files | ||
%{_cross_bindir}/hello-agent | ||
%{_cross_unitdir}/hello-agent.service | ||
%{_cross_unitdir}/hello-agent.timer |
19 changes: 19 additions & 0 deletions
19
tests/projects/local-kit/packages/hello-agent/hello-agent.timer
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,19 @@ | ||
[Unit] | ||
Description=Scheduled Hello-Agent Pings | ||
|
||
[Timer] | ||
# Don't run missed executions | ||
Persistent=false | ||
# Run 5 seconds after startup | ||
OnStartupSec=5 | ||
# Run every 5 sec thereafter | ||
OnUnitActiveSec=5 | ||
# Don't fire at exactly the same second across machines started together. | ||
RandomizedDelaySec=1 | ||
# We don't want to extend the startup report too long after the requested time. | ||
AccuracySec=1 | ||
# File describing job to execute | ||
Unit=hello-agent.service | ||
|
||
[Install] | ||
WantedBy=timers.target |
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,20 @@ | ||
[package] | ||
name = "hello-go" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
build = "../build.rs" | ||
|
||
[package.metadata.build-package] | ||
source-groups = ["hello-go"] | ||
|
||
[lib] | ||
path = "../packages.rs" | ||
|
||
# RPM BuildRequires | ||
[build-dependencies] | ||
# None | ||
|
||
# RPM Requires | ||
[dependencies] | ||
# None |
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,9 @@ | ||
[Unit] | ||
Description=Send a hello-go Ping | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=false | ||
StandardError=journal+console | ||
ExecStart=/usr/bin/hello-go | ||
TimeoutStartSec=30s |
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,43 @@ | ||
%global _cross_first_party 1 | ||
%undefine _debugsource_packages | ||
|
||
Name: %{_cross_os}hello-go | ||
Version: 0.0 | ||
Release: 0%{?dist} | ||
Summary: hello-go | ||
License: Apache-2.0 OR MIT | ||
URL: https://github.com/bottlerocket-os/bottlerocket | ||
|
||
# sources < 100: misc | ||
|
||
# 1xx sources: systemd units | ||
Source103: hello-go.service | ||
Source104: hello-go.timer | ||
|
||
BuildRequires: %{_cross_os}glibc-devel | ||
Requires: %{_cross_os}hello-go | ||
|
||
%description | ||
%{summary}. | ||
|
||
%prep | ||
%setup -T -c | ||
cp -r %{_builddir}/sources/hello-go/* . | ||
|
||
%build | ||
%set_cross_go_flags | ||
go build -buildmode=pie -ldflags="${GOLDFLAGS}" -o hello-go ./cmd/hello-go | ||
|
||
%install | ||
install -d %{buildroot}%{_cross_bindir} | ||
install -p -m 0755 hello-go %{buildroot}%{_cross_bindir} | ||
|
||
install -d %{buildroot}%{_cross_unitdir} | ||
install -p -m 0644 \ | ||
%{S:103} %{S:104} \ | ||
%{buildroot}%{_cross_unitdir} | ||
|
||
%files | ||
%{_cross_bindir}/hello-go | ||
%{_cross_unitdir}/hello-go.service | ||
%{_cross_unitdir}/hello-go.timer |
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,19 @@ | ||
[Unit] | ||
Description=Scheduled Hello-Go Pings | ||
|
||
[Timer] | ||
# Don't run missed executions | ||
Persistent=false | ||
# Run 120 seconds after startup | ||
OnStartupSec=5 | ||
# Run every 5 sec thereafter | ||
OnUnitActiveSec=5 | ||
# Don't fire at exactly the same second across machines started together. | ||
RandomizedDelaySec=1 | ||
# We don't want to extend the startup report too long after the requested time. | ||
AccuracySec=1 | ||
# File describing job to execute | ||
Unit=hello-go.service | ||
|
||
[Install] | ||
WantedBy=timers.target |
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,7 @@ | ||
/*! | ||
This is an intentionally empty file that all of the package `Cargo.toml` files can point to as their | ||
`lib.rs`. The build system uses `build.rs` to invoke `buildsys` but Cargo needs something to compile | ||
so we give it an empty `lib.rs` file. | ||
!*/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,3 @@ | ||
[workspace] | ||
resolver = "1" | ||
members = ["hello-agent"] |
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 @@ | ||
|
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,43 @@ | ||
[licenses] | ||
unlicensed = "deny" | ||
|
||
# Deny licenses unless they are specifically listed here | ||
copyleft = "deny" | ||
allow-osi-fsf-free = "neither" | ||
default = "deny" | ||
|
||
# We want really high confidence when inferring licenses from text | ||
confidence-threshold = 0.93 | ||
|
||
# Commented license types are allowed but not currently used | ||
allow = [ | ||
"Apache-2.0", | ||
# "BSD-2-Clause", | ||
# "BSD-3-Clause", | ||
# "BSL-1.0", | ||
# "CC0-1.0", | ||
# "ISC", | ||
"MIT", | ||
# "OpenSSL", | ||
# "Unlicense", | ||
# "Zlib", | ||
] | ||
|
||
exceptions = [] | ||
|
||
|
||
[bans] | ||
# Deny multiple versions or wildcard dependencies. | ||
multiple-versions = "deny" | ||
wildcards = "deny" | ||
|
||
deny = [{ name = "structopt" }, { name = "clap", wrappers = ["cargo-readme"] }] | ||
|
||
skip = [] | ||
|
||
skip-tree = [] | ||
|
||
[sources] | ||
# Deny crates from unknown registries or git repositories. | ||
unknown-registry = "deny" | ||
unknown-git = "deny" |
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,7 @@ | ||
[package] | ||
name = "hello-agent" | ||
version = "0.1.0" | ||
authors = ["Ethan Pullen <[email protected]>"] | ||
license = "Apache-2.0 OR MIT" | ||
edition = "2021" | ||
publish = false |
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 @@ | ||
fn main() {} |
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,6 @@ | ||
use std::process; | ||
|
||
fn main() -> ! { | ||
println!("Hello from hello-agent"); | ||
process::exit(0) | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/projects/local-kit/sources/hello-go/cmd/hello-go/main.go
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,11 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func main() { | ||
fmt.Println("Hello Go") | ||
os.Exit(0) | ||
} |
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,3 @@ | ||
module hello-go | ||
|
||
go 1.19 |
Oops, something went wrong.