File build.specials.obscpio of Package uyuni-tools
07070100000000000081a400000000000000000000000168ed21dd0000007e000000000000000000000000000000000000001900000000.devcontainer/Dockerfile# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
FROM mcr.microsoft.com/devcontainers/go:1.21
07070100000001000081a400000000000000000000000168ed21dd00000583000000000000000000000000000000000000002000000000.devcontainer/devcontainer.json// SPDX-FileCopyrightText: 2024 SUSE LLC
//
// SPDX-License-Identifier: Apache-2.0
{
"name": "uyuni-tools-devcontainer",
"build": { "dockerfile": "Dockerfile" },
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/guiyomh/features/golangci-lint:0": {},
"ghcr.io/stuartleeks/dev-container-features/dev-tunnels:0": {},
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/duduribeiro/devcontainer-features/neovim:1": { "version": "nightly" },
"ghcr.io/devcontainers/features/python:1": {
"toolsToInstall": "pre-commit"
}
},
// Configure tool-specific properties.
// "customizations": {},
"customizations": {
"vscode": {
"extensions": [
"aldijav.golangwithdidi",
"golang.go",
"NeonXP.gotools",
"honnamkuan.golang-snippets",
"RVSmartPorting.rpm-spec-ext",
"ms-vscode-remote.remote-containers"
]
}
},
"postCreateCommand": "curl -fLo \"${XDG_DATA_HOME:-$HOME/.local/share}\"/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim && echo \"alias vim='nvim -u .devcontainer/init.vim'\" >> ~/.bashrc && nvim -u ${containerWorkspaceFolder}/.devcontainer/init.vim +PlugInstall +qall && cd ${containerWorkspaceFolder} && go mod download && pre-commit install-hooks && ./install-hooks.sh"
}
07070100000002000081a400000000000000000000000168ed21dd00001eaf000000000000000000000000000000000000001700000000.devcontainer/init.vim" SPDX-FileCopyrightText: 2024 SUSE LLC
"
" SPDX-License-Identifier: Apache-2.0
syntax enable
set tabstop=4
set expandtab
set number
set autoindent
set nocompatible
set mouse=a
set textwidth=0
set formatoptions+=t
set formatoptions-=l
set linebreak
set wrap
set tags=./tags
filetype off
call plug#begin()
Plug 'fatih/vim-go'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tpope/vim-fugitive'
Plug 'craigemery/vim-autotag', {'branch':'master'}
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'nvim-lua/plenary.nvim'
Plug 'BurntSushi/ripgrep'
Plug 'sharkdp/fd'
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'nvim-tree/nvim-web-devicons'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.6' }
call plug#end()
" run go imports on file save
let g:go_fmt_command = "goimports"
" automatically highlight variable your cursor is on
let g:go_auto_sameids = 0
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1
" Use tab for trigger completion with characters ahead and navigate
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" Highlight the symbol and its references when holding the cursor
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s)
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Applying code actions to the selected code block
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying code actions at the cursor position
nmap <leader>ac <Plug>(coc-codeaction-cursor)
" Remap keys for apply code actions affect whole buffer
nmap <leader>as <Plug>(coc-codeaction-source)
" Apply the most preferred quickfix action to fix diagnostic on the current line
nmap <leader>qf <Plug>(coc-fix-current)
" Remap keys for applying refactor code actions
nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
xmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
nmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
" Run the Code Lens action on the current line
nmap <leader>cl <Plug>(coc-codelens-action)
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Remap <C-f> and <C-b> to scroll float windows/popups
if has('nvim-0.4.0') || has('patch-8.2.0750')
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif
" Use CTRL-S for selections ranges
" Requires 'textDocument/selectionRange' support of language server
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Add `:Format` command to format current buffer
command! -nargs=0 Format :call CocActionAsync('format')
" Add `:Fold` command to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
" Add (Neo)Vim's native statusline support
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Mappings for CoCList
" Show all diagnostics
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
" Do default action for previous item
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
" Start NERDTree and put the cursor back in the other window.
autocmd VimEnter * NERDTree | wincmd p
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
autocmd BufEnter * if winnr() == winnr('h') && bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
let g:go_build_tags = 'ptf,nok8s'
07070100000003000041ed00000000000000000000000168ed21dd00000000000000000000000000000000000000000000000e00000000.devcontainer07070100000004000081a400000000000000000000000168ed21dd00000683000000000000000000000000000000000000002100000000.github/PULL_REQUEST_TEMPLATE.md<!--
SPDX-FileCopyrightText: 2024 SUSE LLC
SPDX-License-Identifier: Apache-2.0
-->
## What does this PR change?
**add description**
## Codespace
<!-- Button to create CodeSpace -->
Check if you already have a running container clicking on [](https://github.com/codespaces)
[](https://codespaces.new/uyuni-project/uyuni-tools) [](https://docs.github.com/en/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces) [](https://github.com/settings/billing/summary) [](https://github.com/settings/billing/spending_limit)
## Test coverage
- No tests: **add explanation**
- No tests: already covered
- Unit tests were added
- [ ] **DONE**
## Links
Issue(s): #
- [ ] **DONE**
## Changelogs
Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository
If you don't need a changelog check, please mark this checkbox:
- [ ] No changelog needed
If you uncheck the checkbox after the PR is created, you will need to re-run `changelog_test` (see below)
# Before you merge
Check [How to branch and merge properly](https://github.com/uyuni-project/uyuni/wiki/How-to-branch-and-merge-properly)!
07070100000005000081a400000000000000000000000168ed21dd00000209000000000000000000000000000000000000001700000000.github/dependabot.yml# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
07070100000006000081a400000000000000000000000168ed21dd000006f6000000000000000000000000000000000000001c00000000.github/workflows/build.yml# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
name: Build
on:
pull_request:
types:
- opened
- reopened
- synchronize
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
fetch-tags: true
fetch-depth: 0
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 #v5.3.0
with:
go-version: '1.22'
- name: Install dependencies
run: |
go get ./...
- name: Compute version
run: |
tag=$(git describe --tags --abbrev=0)
version=$(git describe --tags --abbrev=0 | cut -f 3 -d '-')
offset=$(git rev-list --count ${tag}..)
echo "VERSION=$tag-$offset" >> "$GITHUB_ENV"
- name: Build
run: |
mkdir -p ./bin
go build \
-tags netgo \
-ldflags "-X github.com/uyuni-project/uyuni-tools/shared/utils.Version=${{ env.VERSION }}" \
-o ./bin \
./...
- name: Build with all tags
run: |
mkdir -p ./bin
go build \
-tags netgo,nok8s,ptf \
-ldflags "-X github.com/uyuni-project/uyuni-tools/shared/utils.Version=${{ env.VERSION }}" \
-o ./bin \
./...
- name: Unit tests with all tags
run: go test -tags nok8s,ptf ./...
- name: Unit tests
run: go test ./...
- name: Upload binaries
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4.6.1
with:
name: binaries
path: ./bin/*
07070100000007000081a400000000000000000000000168ed21dd000009b4000000000000000000000000000000000000002100000000.github/workflows/changelogs.yml# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
name: Changelogs
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
changelog_test:
name: Test changelog entries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
fetch-depth: 1
- id: master
name: Get modified master changelog files
uses: Ana06/get-changed-files@25f79e676e7ea1868813e21465014798211fad8c #v2.3.0
with:
filter: '*.changes'
- name: Fail if the master changelog files are modified
if: steps.master.outputs.all
run: |
echo "Master changelog files cannot be modified directly."
echo "Please revert your changes on the following master changelog file(s):"
for file in ${{steps.master.outputs.all}}
do
echo " - $file"
done
echo
echo "See https://github.com/uyuni-project/uyuni/wiki/Contributing for a guide to writing checklogs."
exit 1
- id: changelogs
name: Get modified changelog files
if: "!contains(github.event.pull_request.body, '[x] No changelog needed')"
uses: Ana06/get-changed-files@25f79e676e7ea1868813e21465014798211fad8c #v2.3.0
with:
filter: '*.changes.*'
- name: Fail if no changelog entries are added
if: steps.changelogs.conclusion == 'success' && steps.changelogs.outputs.added_modified == ''
run: |
echo "No changelog entry found. Please add the required changelog entries."
echo "See https://github.com/uyuni-project/uyuni/wiki/Contributing for a guide to writing checklogs."
exit 1
# warns the user if they merged the PR, but the changelog test failed
warn_user_if_merged:
name: Warn user if merged
if: always() && github.event.action == 'closed' && github.event.pull_request.merged == true && needs.changelog_test.result == 'failure'
needs: changelog_test
runs-on: ubuntu-latest
steps:
- name: Remind the author with a comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 #v4.0.0
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
:warning: No changelog entry has been added. @${{ github.event.pull_request.user.login }}, please add necessary changelog entries with an additional PR.
07070100000008000081a400000000000000000000000168ed21dd00000278000000000000000000000000000000000000002100000000.github/workflows/check_l10n.yml# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
name: l10n-check
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
l10n-check:
name: localizable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- name: Check localizable strings
shell: bash -x {0}
run: ./check_localizable
- uses: cbosdo/gettext-go-lint@118d756ec8dc7b45cd5e560dcaaecf45fd17d891 # gettext-go-lint-0.1.1-0
name: Localizable strings linter
with:
keywords: L,NL,PL
07070100000009000081a400000000000000000000000168ed21dd0000012d000000000000000000000000000000000000002100000000.github/workflows/git-checks.yml# SPDX-FileCopyrightText: 2019 Brad Erickson
#
# SPDX-License-Identifier: MIT
name: Git Checks
on: [pull_request]
jobs:
block-fixup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.0.0
- name: Block Fixup Commit Merge
uses: 13rac1/block-fixup-merge-action@v2.0.0
0707010000000a000081a400000000000000000000000168ed21dd0000089b000000000000000000000000000000000000002400000000.github/workflows/golangci-lint.yml# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
name: golangci-lint
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 #v5.3.0
with:
go-version: '1.22'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@4696ba8babb6127d732c3c6dde519db15edab9ea #v6.5.1
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.59.1
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
#
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# Optional: if set to true, then all caching functionality will be completely disabled,
# takes precedence over all other caching options.
# skip-cache: true
# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
# skip-pkg-cache: true
# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
# skip-build-cache: true
# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"
0707010000000b000081a400000000000000000000000168ed21dd00000510000000000000000000000000000000000000002200000000.github/workflows/mingo_build.yml# SPDX-FileCopyrightText: 2025 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
name: Build with oldest go
on:
pull_request:
types:
- opened
- reopened
- synchronize
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
fetch-tags: true
fetch-depth: 0
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 #v5.3.0
with:
go-version: '1.19'
- name: Install dependencies
run: |
go get ./...
- name: Compute version
run: |
tag=$(git describe --tags --abbrev=0)
version=$(git describe --tags --abbrev=0 | cut -f 3 -d '-')
offset=$(git rev-list --count ${tag}..)
echo "VERSION=$tag-$offset" >> "$GITHUB_ENV"
- name: Build with oldest go
run: |
mkdir -p ./bin
go build \
-tags nok8s \
-ldflags "-X github.com/uyuni-project/uyuni-tools/shared/utils.Version=${{ env.VERSION }}" \
-o ./bin \
./...
- name: Unit tests with all tags
run: go test -tags nok8s ./...
0707010000000c000081a400000000000000000000000168ed21dd00000509000000000000000000000000000000000000002c00000000.github/workflows/prebuilt_devcontainer.yml# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
name: 'pre-built devcontainer'
on:
push:
branches:
- main
jobs:
devcontainer-build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checkout
id: checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- name: Compute tag for devcontainer image
id: meta
run: |
tag=$(git rev-parse --short HEAD)
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Login to GHCR
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 #v3.4.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release devcontainer
run: |
npm install -g @devcontainers/cli
devcontainer build \
--workspace-folder . \
--image-name ghcr.io/${{ github.repository }}/devcontainer:${{ steps.meta.outputs.tag }} \
--image-name ghcr.io/${{ github.repository }}/devcontainer:latest \
--push
env:
BUILDX_NO_DEFAULT_ATTESTATIONS: true
0707010000000d000081a400000000000000000000000168ed21dd00000206000000000000000000000000000000000000001c00000000.github/workflows/reuse.yml# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
#
# SPDX-License-Identifier: CC0-1.0
name: REUSE Compliance Check
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- name: REUSE Compliance Check
uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 #v5.0.0
0707010000000e000081a400000000000000000000000168ed21dd00000343000000000000000000000000000000000000002000000000.github/workflows/vulncheck.yml# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
name: Vulnerability check
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
govulncheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
fetch-tags: true
fetch-depth: 0
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 #v5.3.0
with:
go-version: '1.22'
check-latest: true
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
shell: bash
- id: govulncheck
name: Run govulncheck
run: govulncheck -tags ptf ./...
shell: bash
0707010000000f000041ed00000000000000000000000168ed21dd00000000000000000000000000000000000000000000001200000000.github/workflows07070100000010000041ed00000000000000000000000168ed21dd00000000000000000000000000000000000000000000000800000000.github07070100000011000081a400000000000000000000000168ed21dd00000082000000000000000000000000000000000000000b00000000.gitignore# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
bin
vendor.tar.gz
*.pyc
__pycache__
**/tags
*.mo
07070100000012000081a400000000000000000000000168ed21dd000004be000000000000000000000000000000000000000e00000000.golangci.yml# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
linters-settings:
stylecheck:
dot-import-whitelist:
- github.com/uyuni-project/uyuni-tools/shared/l10n
initialisms:
# Default
- ACL
- API
- ASCII
- CPU
- DNS
- EOF
- GUID
- HTML
- HTTP
- HTTPS
- ID
- IP
- JSON
- RPC
- SLA
- SMTP
- SQL
- SSH
- TCP
- TLS
- TTL
- UDP
- UI
- GID
- UID
- UUID
- URI
- URL
- UTF8
- VM
- XML
- RTP
- DB
# Added
- SCC
- SSL
gofmt:
simplify: true
gocyclo:
min-complexity: 10
govet:
disable:
- printf
linters:
enable:
- unused
- dupl
- errcheck
- errname
- errorlint
- godot
- gofmt
- goimports
- gosimple
#- gocyclo
- ineffassign
- govet
- lll
- misspell
- revive
- staticcheck
- stylecheck
- unparam
- unused
- whitespace
issues:
exclude-rules:
- linters:
- revive
text: "dot-imports"
- linters:
- revive
text: "stutters"
07070100000013000081a400000000000000000000000168ed21dd000005ed000000000000000000000000000000000000001800000000.pre-commit-config.yaml# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
#
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/golangci/golangci-lint
rev: v1.59.1
hooks:
- id: golangci-lint
fail_fast: true
stages:
- pre-push
- repo: https://github.com/fsfe/reuse-tool
rev: v4.0.3
hooks:
- id: reuse
- repo: https://github.com/cbosdo/gettext-go-lint
rev: gettext-go-lint-0.1.1-0
hooks:
- id: lint
args:
- --keyword=L,NL,PL
- repo: local
hooks:
- id: check-localizable
name: Check localizable strings
entry: ./check_localizable
files: '.*\.go'
language: script
- id: build
name: Build
fail_fast: true
pass_filenames: false
entry: ./pre-commit-build.sh
language: script
stages:
- pre-push
- id: build-all-tags
name: Build with all tags
fail_fast: true
pass_filenames: false
entry: ./pre-commit-build.sh
language: script
args:
- -tags=nok8s,ptf
stages:
- pre-push
- id: copyright-year
name: Copyright year is up to date in changed files
entry: ./update-copyright-year.sh
language: script
require_serial: true
stages:
- pre-push
- pre-commit
07070100000014000081a400000000000000000000000168ed21dd00000726000000000000000000000000000000000000001700000000.tito/custom/custom.py# Copyright (c) 2018 SUSE Linux Products GmbH
# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: GPL-2.0-only
"""
Code for building packages in SUSE that need generated code not tracked in git.
"""
import os
from tito.builder import Builder
from tito.common import info_out, run_command, debug
class SuseGitExtraGenerationBuilder(Builder):
def _setup_sources(self):
Builder._setup_sources(self)
setup_execution_file_name = "setup.sh"
setup_file_dir = os.path.join(self.git_root, self.relative_project_dir)
setup_file_path = os.path.join(setup_file_dir, setup_execution_file_name)
if os.path.exists(setup_file_path):
info_out("Executing %s" % setup_file_path)
output = run_command("[[ -x %s ]] && %s" % (setup_file_path, setup_file_path), True)
filename = output.split('\n')[-1]
if filename and os.path.exists(os.path.join(setup_file_dir, filename)):
info_out("Copying %s to %s" % (os.path.join(setup_file_dir, filename), self.rpmbuild_sourcedir))
run_command("cp %s %s/" % (os.path.join(setup_file_dir, filename), self.rpmbuild_sourcedir), True)
self.sources.append(os.path.join(self.rpmbuild_sourcedir, filename))
source_push = os.path.join(setup_file_dir, "push.sh")
if os.path.exists(source_push):
push_path = os.path.join(self.rpmbuild_sourcedir, "push.sh")
run_command("cp %s %s/" % (source_push, self.rpmbuild_sourcedir), True)
self.sources.append(push_path)
run_command(f"sed '/^URL: .*$/aSource10000: push.sh' -i {self.spec_file}")
cleanup = f"\nsed '/^Source10000: push.sh/d' -i $SRPM_PKG_DIR/{self.spec_file_name}"
with open(push_path, "a") as fd:
fd.write(cleanup)
07070100000015000041ed00000000000000000000000168ed21dd00000000000000000000000000000000000000000000000d00000000.tito/custom07070100000016000081a400000000000000000000000168ed21dd0000000c000000000000000000000000000000000000001b00000000.tito/packages/uyuni-tools5.1.21-0 ./
07070100000017000041ed00000000000000000000000168ed21dd00000000000000000000000000000000000000000000000f00000000.tito/packages07070100000018000081a400000000000000000000000168ed21dd000000cb000000000000000000000000000000000000001100000000.tito/tito.props[buildconfig]
builder = custom.SuseGitExtraGenerationBuilder
tagger = tito.tagger.SUSETagger
changelog_with_email = 0
changelog_do_not_remove_cherrypick = 0
no_default_changelog = 1
lib_dir=.tito/custom
07070100000019000041ed00000000000000000000000168ed21dd00000000000000000000000000000000000000000000000600000000.tito0707010000001a000081a400000000000000000000000168ed21dd00000189000000000000000000000000000000000000000700000000.vimrc" SPDX-FileCopyrightText: 2023 SUSE LLC
"
" SPDX-License-Identifier: Apache-2.0
" Local vim configuration loaded by https://github.com/LucHermitte/local_vimrc
" For local_vimrc to use this file, ensure .vimrc is in the g:local_vimrc
" list. You can set it like the following in the vim or neovim config:
"
" let g:local_vimrc = ['.vimrc']
" Set make command
set makeprg=go\ build\ ./...
0707010000001b000081ed00000000000000000000000168ed21dd00000082000000000000000000000000000000000000001600000000.vscode/settings.json// SPDX-FileCopyrightText: 2024 SUSE LLC
//
// SPDX-License-Identifier: Apache-2.0
{
"gopls": { "ui.semanticTokens": true }
}
0707010000001c000041ed00000000000000000000000168ed21dd00000000000000000000000000000000000000000000000800000000.vscode0707010000001d000081ed00000000000000000000000168ed21dd000003b3000000000000000000000000000000000000000900000000build.sh#!/usr/bin/sh
# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
set -e
mkdir -p ./bin
build_tags=$1
if [ -n "${build_tags}" ]; then
build_tags="-tags ${build_tags}"
fi
tag=$(git describe --tags --abbrev=0)
version=$(git describe --tags --abbrev=0 | cut -f 3 -d '-')
offset=$(git rev-list --count ${tag}..)
VERSION_NAME=github.com/uyuni-project/uyuni-tools/shared/utils.Version
CGO_ENABLED=0 go build ${build_tags} -ldflags "-X ${VERSION_NAME}=${tag}-${offset} ${GO_LDFLAGS}" -o ./bin ./...
for shell in "bash" "zsh" "fish"; do
COMPLETION_FILE="./bin/completion.${shell}"
# generate and source shell completion scripts for mgradm and mgrctl
./bin/mgradm completion ${shell} > "${COMPLETION_FILE}"
./bin/mgrctl completion ${shell} >> "${COMPLETION_FILE}"
./bin/mgrpxy completion ${shell} >> "${COMPLETION_FILE}"
done
GOFLAGS="-tags=ptf" golangci-lint run
./check_localizable
echo "DONE"
0707010000001e000081ed00000000000000000000000168ed21dd00000698000000000000000000000000000000000000001200000000check_localizable#!/bin/sh
#
# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
res=0
grep -r . --include '*.go' --exclude '*_test.go' --exclude-dir 'testutils' --exclude-dir='vendor' -n \
-e 'fmt\.Errorf("[^"]\+"' \
-e 'errors.New("[^"]\+"' \
-e '\(Fatal\|Error\|Info\|Warn\)()\(\.Err(err)\)\?\.Msgf\?("' \
-e '\.Flags()\.\(String\|Int\|Bool\)\(Slice\)\?\(Var\)\?P\?([^)]\+, \+"[^"]\+")' \
-e '\(Short\|Long\|Title\): \+["`]' | while read -r line
do
file=$(echo "$line"i | cut -d: -f1)
line_number=$(echo "$line" | cut -d: -f2)
previous_line_number=$(expr "$line_number" - 1)
# Check if a previous line exists
if [ "$previous_line_number" -gt 0 ]; then
previous_line=$(sed -n "${previous_line_number}p" ${file})
# Check if the previous line contains the ignore comment
if ! echo "$previous_line" | grep -q "// *l10n-ignore"; then
echo "$line"
fi
else
echo "$line" # Print it as there is no previous line to ignore.
res=1
fi
done
if test $res -ne 0; then
echo -e "Fix the non localizable strings\n"
res=1
fi
grep -r . --include '*.go' --exclude '*_test.go' --exclude-dir 'testutils' --exclude-dir='vendor' -n \
-e '\(Trace\|Debug\)()\(\.Err(err)\)\?\.Msgf\?(P\?N\?L("' \
if test $? -eq 0; then
echo -e "Trace and debug messages shouldn't be localizable\n"
res=1
fi
grep -r . --include '*.go' --exclude '*_test.go' --exclude-dir 'testutils' --exclude-dir='vendor' -n \
-e '\(Short\|Long\): \+P\?N\?L(["`][a-z]'
if test $? -eq 0; then
echo -e "Short and Long messages shouldn't start with a lowercase letter\n"
res=1
fi
exit $res
0707010000001f000081ed00000000000000000000000168ed21dd000004d7000000000000000000000000000000000000001000000000extract_strings#!/bin/sh
#
# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
for MODULE in mgrctl mgradm mgrpxy shared; do
# Generate the pot file
echo "Generate locale/${MODULE}/${MODULE}.pot"
find ${MODULE} -type f -not -name '*_test.go' -name '*.go' | sort | xargs xgettext --no-wrap --keyword="PL:1c,2" --keyword="NL:1,2" --keyword="L" --language=Javascript --from-code=UTF-8 -o locale/${MODULE}/${MODULE}.pot -
msguniq --no-wrap -o locale/${MODULE}/${MODULE}-uniq.pot locale/${MODULE}/${MODULE}.pot
mv locale/${MODULE}/${MODULE}-uniq.pot locale/${MODULE}/${MODULE}.pot
# Update the po files
for PO in locale/${MODULE}/*.po; do
echo -n "Update ${PO}"
if msgmerge --previous --no-wrap --update ${PO} locale/${MODULE}/${MODULE}.pot;
then
if test -f ${PO}~; then
rm ${PO}~
fi
else
echo "msgmerge for ${PO} failed"
fi
done
done
# Commit the changes
for change in `git diff --numstat | awk '{print $1}'`; do
if [ $change -gt 1 ]; then
git add -u
git commit -m "update strings for translations"
exit
fi
done
git reset --hard
07070100000020000081ed00000000000000000000000168ed21dd0000009b000000000000000000000000000000000000001100000000install-hooks.sh#!/bin/bash
# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
pre-commit install --hook-type pre-commit --hook-type pre-push
07070100000021000081ed00000000000000000000000168ed21dd0000007f000000000000000000000000000000000000001400000000pre-commit-build.sh#!/bin/bash
# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
go build $* ./...
go test $* ./...
07070100000022000081ed00000000000000000000000168ed21dd000000c6000000000000000000000000000000000000000900000000setup.sh# SPDX-FileCopyrightText: 2023 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
set -euxo pipefail
go mod vendor && tar czvf vendor.tar.gz vendor >/dev/null && rm -rf vendor
echo "vendor.tar.gz"
07070100000023000081ed00000000000000000000000168ed21dd00000179000000000000000000000000000000000000001900000000update-copyright-year.sh#!/bin/sh
#
# SPDX-FileCopyrightText: 2025 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
current_year=$(date +%Y)
for changed_file in $@; do
sed -i -E "s/\/\/ SPDX-FileCopyrightText: [0-9]{4}/\/\/ SPDX-FileCopyrightText: $current_year/" $changed_file
done
if test $(git status --porcelain | wc -l) -ne 0 ; then
echo "✨ Copyright year adjusted, please commit"
fi
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!!