diff --git a/.github/workflows/build_and_release_image.yaml b/.github/workflows/build_and_release_image.yaml index dab820c..701d1d7 100644 --- a/.github/workflows/build_and_release_image.yaml +++ b/.github/workflows/build_and_release_image.yaml @@ -17,14 +17,14 @@ jobs: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - name: Set up latest stable Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version: stable - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@v4 - name: Checkout out the repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-tags: 1 fetch-depth: 1 @@ -38,13 +38,13 @@ jobs: echo "BUILD_USER=$(whoami)" >> $GITHUB_ENV - name: Docker Login - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Release with goreleaser - uses: goreleaser/goreleaser-action@v6 + uses: goreleaser/goreleaser-action@v7 env: GITHUB_TOKEN: ${{ github.token }} with: @@ -64,16 +64,16 @@ jobs: echo "digest=$(cat digest.txt)" >> $GITHUB_OUTPUT - name: Attest power-control binary amd64 - uses: actions/attest-build-provenance@v1 + uses: actions/attest-build-provenance@v4 with: subject-path: dist/remote-console_linux_amd64_v3/remote-console # TODO: ARM builds aren't viable yet #- name: Attest power-control binary arm64 - # uses: actions/attest-build-provenance@v1 + # uses: actions/attest-build-provenance@v4 # with: # subject-path: dist/pcs_linux_arm64_v8.0/power-control - name: Generate build provenance - uses: actions/attest-build-provenance@v1 + uses: actions/attest-build-provenance@v4 with: subject-name: ghcr.io/openchami/remote-console subject-digest: ${{ steps.process_goreleaser_output.outputs.digest }} diff --git a/.github/workflows/build_ipmi_sim.yaml b/.github/workflows/build_ipmi_sim.yaml new file mode 100644 index 0000000..3026f3b --- /dev/null +++ b/.github/workflows/build_ipmi_sim.yaml @@ -0,0 +1,55 @@ +name: Build and publish ipmi-sim + +on: + push: + branches: + - main + paths: + - 'ipmi_sim/**' + - 'ipmi_sim/VERSION' + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v6 + + - name: Read version + id: version + run: echo "version=$(cat ipmi_sim/VERSION)" >> "$GITHUB_OUTPUT" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + + - name: Docker Login + uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker metadata + id: meta + uses: docker/metadata-action@v6 + with: + images: ghcr.io/openchami/ipmi-sim + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=${{ steps.version.outputs.version }} + type=sha,prefix=,format=short + + - name: Build and push + uses: docker/build-push-action@v7 + with: + context: ipmi_sim + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml index ce2cf72..c4bff08 100644 --- a/.github/workflows/integration_test.yaml +++ b/.github/workflows/integration_test.yaml @@ -8,9 +8,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version-file: go.mod - name: Build remote-console binary for Dockerfile diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 4328435..dcd15b9 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -12,12 +12,12 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Setup Go 1.26 - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version: 1.26 - name: golangci-lint - uses: golangci/golangci-lint-action@v8 + uses: golangci/golangci-lint-action@v9 with: version: latest diff --git a/.github/workflows/unit_test.yaml b/.github/workflows/unit_test.yaml index 92471e1..f118d78 100644 --- a/.github/workflows/unit_test.yaml +++ b/.github/workflows/unit_test.yaml @@ -8,9 +8,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version-file: go.mod - name: Run unit tests diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b17bd17..72e8ac0 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,4 +1,4 @@ -version: 2.4 +version: 2 project_name: remote-console before: @@ -36,22 +36,29 @@ builds: -X main.GoVersion={{ .Env.GO_VERSION }} \ -X main.BuildUser={{ .Env.BUILD_USER }} " -dockers: - - image_templates: - - &amd64_linux_image ghcr.io/openchami/{{.ProjectName}}:{{ .Tag }}-amd64 - - ghcr.io/openchami/{{.ProjectName}}:{{ .Major }}-amd64 - - ghcr.io/openchami/{{.ProjectName}}:{{ .Major }}.{{ .Minor }}-amd64 - use: buildx - build_flag_templates: +dockers_v2: + - id: remote-console + ids: + - remote-console + dockerfile: Dockerfile + images: + - ghcr.io/openchami/{{.ProjectName}} + tags: + - "{{ .Tag }}" + - "{{ .Major }}" + - "{{ .Major }}.{{ .Minor }}" + - "latest" + platforms: + - linux/amd64 + # TODO: Add linux/arm64 when ARM base images and conman packages are available + flags: - "--pull" - "--target=ubuntu-goreleaser" - - "--platform=linux/amd64" - - "--label=org.opencontainers.image.created={{.Date}}" - - "--label=org.opencontainers.image.title={{.ProjectName}}" - - "--label=org.opencontainers.image.revision={{.FullCommit}}" - - "--label=org.opencontainers.image.version={{.Version}}" - goarch: amd64 - goamd64: v3 + annotations: + "org.opencontainers.image.created": "{{.Date}}" + "org.opencontainers.image.title": "{{.ProjectName}}" + "org.opencontainers.image.revision": "{{.FullCommit}}" + "org.opencontainers.image.version": "{{.Version}}" extra_files: - LICENSE - CHANGELOG.md @@ -59,48 +66,6 @@ dockers: - configs/ - scripts/ - # TODO: more ARM config that isn't viable yet. - #- image_templates: - # - &arm64v8_linux_image ghcr.io/openchami/{{.ProjectName}}:{{ .Tag }}-arm64 - # - ghcr.io/openchami/{{.ProjectName}}:{{ .Major }}-arm64 - # - ghcr.io/openchami/{{.ProjectName}}:{{ .Major }}.{{ .Minor }}-arm64 - # use: buildx - # build_flag_templates: - # - "--pull" - # - "--platform=linux/arm64" - # - "--label=org.opencontainers.image.created={{.Date}}" - # - "--label=org.opencontainers.image.title={{.ProjectName}}" - # - "--label=org.opencontainers.image.revision={{.FullCommit}}" - # - "--label=org.opencontainers.image.version={{.Version}}" - # goarch: arm64 - # extra_files: - # - LICENSE - # - CHANGELOG.md - # - README.md - # - configs/ - -docker_manifests: - # TODO: ARM ARM ARM - - name_template: "ghcr.io/openchami/{{.ProjectName}}:latest" - image_templates: - - *amd64_linux_image - #- *arm64v8_linux_image - - - name_template: "ghcr.io/openchami/{{.ProjectName}}:{{ .Tag }}" - image_templates: - - *amd64_linux_image - #- *arm64v8_linux_image - - - name_template: "ghcr.io/openchami/{{.ProjectName}}:{{ .Major }}" - image_templates: - - *amd64_linux_image - #- *arm64v8_linux_image - - - name_template: "ghcr.io/openchami/{{.ProjectName}}:{{ .Major }}.{{ .Minor }}" - image_templates: - - *amd64_linux_image - #- *arm64v8_linux_image - archives: - formats: ["tar.gz"] # this name template makes the OS and Arch compatible with the results of uname. @@ -121,11 +86,22 @@ checksum: snapshot: version_template: "{{ incpatch .Version }}-next" changelog: + use: github sort: asc + groups: + - title: Features + regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' + order: 0 + - title: Bug Fixes + regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' + order: 1 + - title: Others + order: 999 filters: exclude: - '^docs:' - '^test:' + - '^chore:' # The lines beneath this are called `modelines`. See `:help modeline` diff --git a/Dockerfile b/Dockerfile index e07076d..98cbb91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,10 +10,12 @@ FROM ubuntu:24.04 AS ubuntu-goreleaser +ARG TARGETPLATFORM + RUN apt -y update RUN apt -y install conman less vim ssh jq tar procps inotify-tools -COPY remote-console /app/ +COPY ${TARGETPLATFORM}/remote-console /app/ COPY scripts/conman.conf.tmpl /app/conman.conf.tmpl COPY scripts/ssh-key-console /usr/bin/ COPY scripts/ssh-pwd-console /usr/bin/ diff --git a/ipmi_sim/VERSION b/ipmi_sim/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/ipmi_sim/VERSION @@ -0,0 +1 @@ +0.1.0