commit
491131321a
6 changed files with 136 additions and 0 deletions
19
.forgejo/workflows/demo.yaml
Normal file
19
.forgejo/workflows/demo.yaml
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
upload-many:
|
||||||
|
runs-on: stackit-ubuntu-22
|
||||||
|
steps:
|
||||||
|
- run: mkdir -p artifacts
|
||||||
|
|
||||||
|
- run: touch artifacts/ONE artifacts/TWO
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: many-artifacts
|
||||||
|
path: artifacts/
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
test -f many-artifacts/ONE
|
||||||
|
test -f many-artifacts/TWO
|
||||||
38
.forgejo/workflows/docker.yaml
Normal file
38
.forgejo/workflows/docker.yaml
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
on: [pr]
|
||||||
|
|
||||||
|
env:
|
||||||
|
JFROG_URL: schwarzit-xx-sit-stackit-dev-exp-docker-local.jfrog.io
|
||||||
|
JFROG_USERNAME: t-do-s-stackit-dev-exp
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: stackit-docker
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Import Secrets
|
||||||
|
id: import-secrets
|
||||||
|
uses: hashicorp/vault-action@v2
|
||||||
|
with:
|
||||||
|
url: https://prod.sm.eu01.stackit.cloud
|
||||||
|
method: userpass
|
||||||
|
username: ${{ secrets.SECRET_MANAGER_USERNAME }}
|
||||||
|
password: ${{ secrets.SECRET_MANAGER_PASSWORD }}
|
||||||
|
secrets: |
|
||||||
|
3332b656-c8e9-4a99-9a87-6086843272bc/data/stackit-git-user-management version
|
||||||
|
- name: echo version
|
||||||
|
run: "echo $VERSION"
|
||||||
|
- name: Sensitive Operation
|
||||||
|
run: "echo '${{ steps.import-secrets.outputs.version }}'"
|
||||||
|
- name: Log in to Artifactory
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.JFROG_URL }}
|
||||||
|
username: ${{ env.JFROG_USERNAME }}
|
||||||
|
password: ${{ secrets.JFROG_PASSWORD }}
|
||||||
|
- name: Build and push image
|
||||||
|
uses: https://code.forgejo.org/docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
push: false
|
||||||
|
tags: ${{ env.JFROG_URL }}/pipeline_test:ok
|
||||||
1
internal/common/logger/logger.go
Normal file
1
internal/common/logger/logger.go
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
package logger
|
||||||
7
main.go
Normal file
7
main.go
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Printf("hello, world")
|
||||||
|
}
|
||||||
27
pkg/app/app.go
Normal file
27
pkg/app/app.go
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RunApp(ctx context.Context) error {
|
||||||
|
u := &User{
|
||||||
|
Name: "hola",
|
||||||
|
}
|
||||||
|
if !UserOK(ctx, u) {
|
||||||
|
return fmt.Errorf("could not found user")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type User struct {
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func UserOK(ctx context.Context, user *User) bool {
|
||||||
|
if user == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
44
pkg/app/app_test.go
Normal file
44
pkg/app/app_test.go
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestUserOK(t *testing.T) {
|
||||||
|
type args struct {
|
||||||
|
ctx context.Context
|
||||||
|
user *User
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
want bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "test ok",
|
||||||
|
args: args{
|
||||||
|
ctx: context.TODO(),
|
||||||
|
user: &User{
|
||||||
|
Name: "hola",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "test not found",
|
||||||
|
args: args{
|
||||||
|
ctx: context.TODO(),
|
||||||
|
user: nil,
|
||||||
|
},
|
||||||
|
want: false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
if got := UserOK(tt.args.ctx, tt.args.user); got != tt.want {
|
||||||
|
t.Errorf("UserOK() = %v, want %v", got, tt.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue