-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
154 additions
and
268 deletions.
There are no files selected for viewing
File renamed without changes.
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 |
---|---|---|
@@ -1,58 +1,62 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
ci: | ||
release: | ||
permissions: | ||
contents: write # required for creating GH release | ||
id-token: write # required for reading vault secrets | ||
runs-on: ubuntu-latest | ||
steps: | ||
# - name: Login to DockerHub | ||
# uses: docker/login-action@v3 | ||
# with: | ||
# registry: ${{ vars.PUBLIC_REGISTRY }} | ||
# username: ${{ secrets.PUBLIC_REGISTRY_USERNAME }} | ||
# password: ${{ secrets.PUBLIC_REGISTRY_PASSWORD }} | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.x | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt --yes install libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config gcc | ||
- name: Lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.59 | ||
- name: Verify | ||
run: | | ||
./scripts/verify.sh | ||
- name: Test | ||
run: | | ||
./scripts/test.sh | ||
- name: Static Build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required for creating GH release | ||
TAG: ${{ github.ref_name }} | ||
COMMIT: ${{ github.sha }} | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
distribution: goreleaser | ||
version: "~> v2" | ||
args: release --clean | ||
# - name: Image Push | ||
# run: | | ||
# make image-push | ||
# env: | ||
# TAG: ${{ github.ref_name }} | ||
# REPO: ${{ vars.PUBLIC_REGISTRY }}/${{ vars.PUBLIC_REGISTRY_REPO }} | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ vars.PUBLIC_REGISTRY }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.ref_name}} | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.x | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config gcc | ||
- name: Lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.61 | ||
- name: Verify | ||
run: | | ||
make verify | ||
- name: Test | ||
run: | | ||
make test | ||
- name: Go Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required for creating GH release | ||
TAG: ${{ github.ref_name }} | ||
COMMIT: ${{ github.sha }} | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
distribution: goreleaser | ||
version: "~> v2" | ||
args: release --clean --verbose | ||
- name: Image Push | ||
run: | | ||
make image-push | ||
env: | ||
TAG: ${{ github.ref_name }} | ||
REPO: ${{ vars.PUBLIC_REGISTRY }}/cnrancher |
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 was deleted.
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 |
---|---|---|
@@ -1,27 +1,39 @@ | ||
TARGETS := ci build test verify | ||
.PHONY: $(TARGETS) $(TEST_TARGETS) validation-test clean help | ||
TAG?=$(shell git describe --abbrev=0 --tags 2>/dev/null || echo "v0.0.0" ) | ||
COMMIT?=$(shell git rev-parse HEAD) | ||
|
||
.dapper: | ||
@echo Downloading dapper | ||
@curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp | ||
@chmod +x .dapper.tmp | ||
@./.dapper.tmp -v | ||
@mv .dapper.tmp .dapper | ||
default: build | ||
|
||
$(TARGETS): .dapper | ||
@./.dapper $@ | ||
.PHONY: build | ||
build: | ||
COMMIT=$(COMMIT) TAG=$(TAG) goreleaser build --snapshot --clean | ||
|
||
validation-test: .dapper | ||
@./.dapper -f Dockerfile.test.dapper | ||
.PHONY: test | ||
test: | ||
./scripts/test.sh | ||
|
||
.PHONY: clean | ||
clean: | ||
@./scripts/clean.sh | ||
./scripts/clean.sh | ||
|
||
.PHONY: verify | ||
verify: | ||
./scripts/verify.sh | ||
|
||
.PHONY: image | ||
image: | ||
TAG=$(TAG) ./scripts/image.sh | ||
|
||
.PHONY: image-push | ||
image-push: | ||
TAG=$(TAG) BUILDX_OPTIONS="--push" ./scripts/image.sh | ||
|
||
.PHONY: help | ||
help: | ||
@echo "Usage:" | ||
@echo " make build - Build 'hangar' executable files in 'bin' folder" | ||
@echo " make test - Run hangar unit test" | ||
@echo " make build-test - Run hangar build test" | ||
@echo " make validation-test - Run hangar validation test" | ||
@echo " make clean - Remove generated files" | ||
@echo " make help - Show this message" | ||
@echo " make build build binary files" | ||
@echo " make test run unit tests" | ||
@echo " make verify verify modules" | ||
@echo " make image build container images" | ||
@echo " make image-push build container images and push" | ||
@echo " make clean clean up built files" | ||
@echo " make help show this message" |
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 |
---|---|---|
@@ -1,16 +1,17 @@ | ||
FROM registry.suse.com/bci/bci-base:15.6 | ||
|
||
WORKDIR /hangar | ||
COPY package/entrypoint.sh / | ||
COPY bin/hangar /usr/local/bin/hangar | ||
COPY package/default-policy.json /etc/containers/policy.json | ||
COPY package/registries.d/default.yaml /etc/containers/registries.d/default.yaml | ||
|
||
RUN zypper up -y && \ | ||
zypper in -y -f libdevmapper1_03 bash-completion vim wget && \ | ||
zypper clean && \ | ||
hangar version && \ | ||
zypper clean -a && \ | ||
rm -rf /tmp/* /var/tmp/* /usr/share/doc/packages/* && \ | ||
echo "# Add hangar bash completion" >> /root/.bashrc && \ | ||
echo "source <(hangar completion bash)" >> /root/.bashrc | ||
|
||
ARG TARGETARCH | ||
WORKDIR /hangar | ||
COPY package/entrypoint.sh / | ||
COPY dist/hangar_linux_${TARGETARCH}*/ /usr/local/bin/ | ||
COPY package/default-policy.json /etc/containers/policy.json | ||
COPY package/registries.d/default.yaml /etc/containers/registries.d/default.yaml | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package utils | ||
|
||
var ( | ||
Version = "v1.8.3" | ||
GitCommit = "" | ||
Version = "unknow" | ||
GitCommit = "head" | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Oops, something went wrong.