Skip to content

Commit

Permalink
feat: use gib entrypoint as alias for gib in container
Browse files Browse the repository at this point in the history
  • Loading branch information
Coenraad Human committed May 27, 2024
1 parent 1befdac commit 2ee09af
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .docker/gib-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ if [ "$(id -u)" -ne "$(stat -c '%u' .)" ]; then
eids="$(stat -c '--euid %u --egid %g' .)"
fi

exec ${eids:+setpriv --clear-groups $eids} gib $@
exec ${eids:+setpriv --clear-groups $eids} real-gib $@
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ target/
.gitattributes
.gitignore
Cargo.lock
CHANGELOG.md
LICENSE
README.md
*.md
6 changes: 4 additions & 2 deletions .github/workflows/update-version-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
echo "========================="
echo "Calculate Project Version"
echo "========================="
calculated_version=$(gib-entrypoint.sh version -p /app)
calculated_version=$(gib version -p /app)
echo "Calculated version: $calculated_version"
echo "============================="
Expand All @@ -49,6 +49,7 @@ jobs:
#if [[ "$calculated_version" =~ $semantic_version_regex ]]; then
sed -i '0, /version/s/version.*/version = "'$(echo $calculated_version)'"/' /app/Cargo.toml
echo "Updated Cargo.toml with new version value."
#else
# echo "Invalid version, can't update version in Cargo.toml"
# exit 1
Expand All @@ -57,7 +58,8 @@ jobs:
echo "=================="
echo "Generate Changelog"
echo "=================="
gib-entrypoint.sh changelog -p /app > CHANGELOG.md
gib changelog -p /app > CHANGELOG.md
echo "Updated CHANGELOG.md"
- name: Commit Changes
run: |
Expand Down
114 changes: 57 additions & 57 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,60 @@

## 1.6.0

|Version|Commit Type|Description|Breaking Change|Deprecation|
|---|---|---|---|---|
|1.6.0|CI|Use entrypoint sh instead of gib directly.| | |
|1.6.0|Feature|Author and committer on changelog.| | |
|1.5.3|CI|Manual trigger for version and changelog job.| | |
|1.5.3|Documentation|Docker information.| | |
|1.5.2|Fix|Docker permission issues regarding repositories and pipelines.| | |
|1.5.1|Documentation|New badges and use gib for changelog generation.| | |
|1.5.0|CI|Remove riscv64 build temporarily.| | |
|1.5.0|CI|Fix shell being used on changelog job.| | |
|1.5.0|Feature|Simple changelog generation.| | |
|1.4.1|Documentation|Changelog.| | |
|1.4.0|Testing|Conventional commit creation testing.| | |
|1.4.0|Feature|Conventional commit creation from regex groups.| | |
|1.3.3|Refactor|Single source of semantic version calculation.| | |
|1.3.2|Refactor|Share logic between version and changelog commands.| | |
|1.3.1|Documentation|Changelog addition to readme.| | |
|1.3.0|Feature|Initial changelog files.| | |
|1.2.2|Fix|Docker build supported archs for base images.| | |
|1.2.1|Chore|Better descriptor for scope filter in help menu.| | |
|1.2.0|Feature|Scope filter to support monorepos.| | |
|1.1.1|CI|Multi arch build docker tag filtering on jobs new changelog for release.| | |
|1.1.1|Documentation|Readme.| | |
|1.1.0|Feature|Alpine docker image for extremely small image size.| | |
|1.0.3|CI|Cross compile binaries job.| | |
|1.0.3|CI|Use rust version of gib.| | |
|1.0.3|CI|Workflow updates.| | |
|1.0.3|CI|Build and test.| | |
|1.0.3|Testing|Commit regex and version calculation.| | |
|1.0.3|Fix|Regular expression for filtering commits.| | |
|1.0.2|Fix|Regular expression for filtering commits.| | |
|1.0.1|Refactor|Rust modules.| | |
|1.0.0|Chore|Licence and recognition of gib introducing breaking changes with move to rust.|X| |
|0.10.1|Documentation|Docker.| | |
|0.10.0|Feature|Auto use current directory when p not supplied.| | |
|0.9.0|CI|Add workflow for calculating version automatically.| | |
|0.9.0|Feature|Smaller docker image using debian slim.| | |
|0.8.0|Feature|Regex for ensuring string is valid before processing.| | |
|0.7.1|Chore|Clean up macos nonsense.| | |
|0.7.0|Feature|Use rust instead of java.| | |
|0.6.5|Documentation|Update to include new clap default help option.| | |
|0.6.4|Chore|Update clap version.| | |
|0.6.3|Fix|Commit regex filter.| | |
|0.6.2|Documentation|Readme update.| | |
|0.6.1|Documentation|Update readme.| | |
|0.6.0|Feature|Add in major minor and patch option functionality.| | |
|0.5.1|Fix|Commit returning wrong normalised version.| | |
|0.5.0|Feature|Utilise clap.| | |
|0.4.1|Refactor|Remove dead code.| | |
|0.4.0|Styling|Checkstyle accommodation for long string lines.| | |
|0.4.0|Feature|Dockerfile and action.| | |
|0.3.1|Chore|Change logging level.| | |
|0.3.0|Feature|Add argument for providing git hook commit message.| | |
|0.2.1|Refactor|Remove unused and clean up.| | |
|0.2.0|Feature|Improved cli argument parser.| | |
|0.1.1|Chore|Improve binary build script.| | |
|0.1.0|Feature|Initial project.| | |
| Version | Commit Type | Description | Breaking Change | Deprecation |
| ------- | ------------- | ------------------------------------------------------------------------------ | --------------- | ----------- |
| 1.6.0 | CI | Use entrypoint sh instead of gib directly. | | |
| 1.6.0 | Feature | Author and committer on changelog. | | |
| 1.5.3 | CI | Manual trigger for version and changelog job. | | |
| 1.5.3 | Documentation | Docker information. | | |
| 1.5.2 | Fix | Docker permission issues regarding repositories and pipelines. | | |
| 1.5.1 | Documentation | New badges and use gib for changelog generation. | | |
| 1.5.0 | CI | Remove riscv64 build temporarily. | | |
| 1.5.0 | CI | Fix shell being used on changelog job. | | |
| 1.5.0 | Feature | Simple changelog generation. | | |
| 1.4.1 | Documentation | Changelog. | | |
| 1.4.0 | Testing | Conventional commit creation testing. | | |
| 1.4.0 | Feature | Conventional commit creation from regex groups. | | |
| 1.3.3 | Refactor | Single source of semantic version calculation. | | |
| 1.3.2 | Refactor | Share logic between version and changelog commands. | | |
| 1.3.1 | Documentation | Changelog addition to readme. | | |
| 1.3.0 | Feature | Initial changelog files. | | |
| 1.2.2 | Fix | Docker build supported archs for base images. | | |
| 1.2.1 | Chore | Better descriptor for scope filter in help menu. | | |
| 1.2.0 | Feature | Scope filter to support monorepos. | | |
| 1.1.1 | CI | Multi arch build docker tag filtering on jobs new changelog for release. | | |
| 1.1.1 | Documentation | Readme. | | |
| 1.1.0 | Feature | Alpine docker image for extremely small image size. | | |
| 1.0.3 | CI | Cross compile binaries job. | | |
| 1.0.3 | CI | Use rust version of gib. | | |
| 1.0.3 | CI | Workflow updates. | | |
| 1.0.3 | CI | Build and test. | | |
| 1.0.3 | Testing | Commit regex and version calculation. | | |
| 1.0.3 | Fix | Regular expression for filtering commits. | | |
| 1.0.2 | Fix | Regular expression for filtering commits. | | |
| 1.0.1 | Refactor | Rust modules. | | |
| 1.0.0 | Chore | Licence and recognition of gib introducing breaking changes with move to rust. | X | |
| 0.10.1 | Documentation | Docker. | | |
| 0.10.0 | Feature | Auto use current directory when p not supplied. | | |
| 0.9.0 | CI | Add workflow for calculating version automatically. | | |
| 0.9.0 | Feature | Smaller docker image using debian slim. | | |
| 0.8.0 | Feature | Regex for ensuring string is valid before processing. | | |
| 0.7.1 | Chore | Clean up macos nonsense. | | |
| 0.7.0 | Feature | Use rust instead of java. | | |
| 0.6.5 | Documentation | Update to include new clap default help option. | | |
| 0.6.4 | Chore | Update clap version. | | |
| 0.6.3 | Fix | Commit regex filter. | | |
| 0.6.2 | Documentation | Readme update. | | |
| 0.6.1 | Documentation | Update readme. | | |
| 0.6.0 | Feature | Add in major minor and patch option functionality. | | |
| 0.5.1 | Fix | Commit returning wrong normalised version. | | |
| 0.5.0 | Feature | Utilise clap. | | |
| 0.4.1 | Refactor | Remove dead code. | | |
| 0.4.0 | Styling | Checkstyle accommodation for long string lines. | | |
| 0.4.0 | Feature | Dockerfile and action. | | |
| 0.3.1 | Chore | Change logging level. | | |
| 0.3.0 | Feature | Add argument for providing git hook commit message. | | |
| 0.2.1 | Refactor | Remove unused and clean up. | | |
| 0.2.0 | Feature | Improved cli argument parser. | | |
| 0.1.1 | Chore | Improve binary build script. | | |
| 0.1.0 | Feature | Initial project. | | |
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ RUN \
echo '[safe]' > /etc/gitconfig && \
echo ' directory = *' /etc/gitconfig

COPY --from=builder /usr/bin/gib /usr/bin/gib
COPY --from=builder /build/.docker/gib-entrypoint.sh /usr/bin/gib-entrypoint.sh
# Convience factor, let entrypoint script be an alias for gib to avoid privilege issues:
COPY --from=builder /usr/bin/gib /usr/bin/real-gib
COPY --from=builder /build/.docker/gib-entrypoint.sh /usr/bin/gib

WORKDIR /app

ENTRYPOINT ["gib-entrypoint.sh"]
ENTRYPOINT ["gib"]
CMD [ "--help" ]
7 changes: 5 additions & 2 deletions src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ pub struct Commit {

pub message: Option<String>,
pub author: Author,
pub committer: Committer
pub committer: Committer,
pub is_tagged: bool,

}

Expand Down Expand Up @@ -96,6 +97,8 @@ pub fn retrieve_branch_commits(path: Option<String>) -> Vec<Commit> {
return revwalk.map(|step| -> Commit {
match step {
Ok(oid) => {
let is_tagged = repo.find_tag(oid).is_ok();

match repo.find_commit(oid) {
Ok(commit) => {
let message = match commit.message() {
Expand Down Expand Up @@ -125,7 +128,7 @@ pub fn retrieve_branch_commits(path: Option<String>) -> Vec<Commit> {
},
};

Commit { message, author, committer }
Commit { message, author, committer, is_tagged }
},
Err(_) => panic!("Could not retrieve oid of commit"),
}
Expand Down

0 comments on commit 2ee09af

Please sign in to comment.