Skip to content

Commit b549353

Browse files
authored
Change repo org (#322)
1 parent 5205250 commit b549353

18 files changed

+159
-43
lines changed

.github/workflows/collector-image.yaml

+84-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,94 @@ defaults:
1919
env:
2020
COLLECTOR_CONTAINER_NAME: tnf-collector
2121
REGISTRY: quay.io
22-
COLLECTOR_IMAGE_NAME: testnetworkfunction/collector
22+
COLLECTOR_IMAGE_NAME: redhat-best-practices-for-k8s/collector
23+
COLLECTOR_IMAGE_NAME_LEGACY: testnetworkfunction/collector
2324
COLLECTOR_IMAGE_TAG: latest
2425
COLLECTOR_SRC_URL: 'https://github.com/${{ github.repository }}'
2526

2627
jobs:
2728
test-and-push-collector-image-main:
29+
name: 'Test and push the collector image'
30+
runs-on: ubuntu-22.04
31+
env:
32+
SHELL: /bin/bash
33+
COLLECTOR_VERSION: ""
34+
CURRENT_VERSION_GENERIC_BRANCH: main
35+
steps:
36+
- name: Checkout generic working branch of the current version
37+
uses: actions/checkout@v4
38+
with:
39+
ref: ${{ env.CURRENT_VERSION_GENERIC_BRANCH }}
40+
fetch-depth: '0'
41+
42+
- name: Get the latest collector version from GIT
43+
run: |
44+
GIT_RELEASE=$(git tag --points-at HEAD | head -n 1)
45+
GIT_PREVIOUS_RELEASE=$(git tag --no-contains HEAD --sort=v:refname | tail -n 1)
46+
GIT_LATEST_RELEASE=$GIT_RELEASE
47+
if [ -z "$GIT_RELEASE" ]; then
48+
GIT_LATEST_RELEASE=$GIT_PREVIOUS_RELEASE
49+
fi
50+
51+
echo "version_number=$GIT_LATEST_RELEASE" >> $GITHUB_OUTPUT
52+
id: set_COLLECTOR_VERSION
53+
54+
- name: Print the latest collector version from GIT
55+
run: |
56+
echo Version tag: ${{ steps.set_COLLECTOR_VERSION.outputs.version_number }}
57+
58+
- name: Update env variables
59+
run: |
60+
echo "COLLECTOR_VERSION=${{ steps.set_COLLECTOR_VERSION.outputs.version_number }}" >> $GITHUB_ENV
61+
62+
- name: Ensure $COLLECTOR_VERSION and $COLLECTOR_IMAGE_TAG are set
63+
run: '[[ -n "$COLLECTOR_VERSION" ]] && [[ -n "$COLLECTOR_IMAGE_TAG" ]]'
64+
65+
- name: Check whether the version tag exists on remote
66+
run: git ls-remote --exit-code $COLLECTOR_SRC_URL refs/tags/$COLLECTOR_VERSION
67+
68+
- name: (if tag is missing) Display debug message
69+
if: ${{ failure() }}
70+
run: echo "Tag '$COLLECTOR_VERSION' does not exist on remote $COLLECTOR_SRC_URL"
71+
72+
- name: Checkout the version tag
73+
uses: actions/checkout@v4
74+
with:
75+
ref: ${{ env.COLLECTOR_VERSION }}
76+
77+
# Build Collector image with latest and version tags
78+
- name: Build the `collector` image
79+
run: |
80+
make build-image-collector-by-version
81+
env:
82+
COLLECTOR_VERSION: ${{ env.COLLECTOR_VERSION }}
83+
84+
# Push the new TNF image to Quay.io.
85+
- name: Authenticate against Quay.io
86+
uses: docker/login-action@v3
87+
with:
88+
registry: ${{ env.REGISTRY }}
89+
# Use a Robot Account to authenticate against Quay.io
90+
# https://docs.quay.io/glossary/robot-accounts.html
91+
username: ${{ secrets.QUAY_ROBOT_USERNAME_K8S }}
92+
password: ${{ secrets.QUAY_ROBOT_TOKEN_K8S }}
93+
94+
- name: Push the newly built image to Quay.io
95+
run: docker push --all-tags ${REGISTRY}/${COLLECTOR_IMAGE_NAME}
96+
97+
- uses: webfactory/[email protected]
98+
name: Add SSH key to agent
99+
with:
100+
ssh-private-key: ${{ secrets.COLLECTOR_KEYPAIR }}
101+
102+
# run ansible deployment to deploy the new image to the cluster
103+
- name: Deploy the newly built image to the cluster
104+
run: |
105+
ANSIBLE_HOST_KEY_CHECKING=false \
106+
COLLECTOR_VERSION=${{ env.COLLECTOR_VERSION }} \
107+
ansible-playbook -i playbooks/inventory.ini playbooks/start-collector.yaml
108+
109+
test-and-push-collector-image-legacy:
28110
name: 'Test and push the collector image'
29111
runs-on: ubuntu-22.04
30112
env:
@@ -91,7 +173,7 @@ jobs:
91173
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
92174

93175
- name: Push the newly built image to Quay.io
94-
run: docker push --all-tags ${REGISTRY}/${COLLECTOR_IMAGE_NAME}
176+
run: docker push --all-tags ${REGISTRY}/${COLLECTOR_IMAGE_NAME_LEGACY}
95177

96178
- uses: webfactory/[email protected]
97179
name: Add SSH key to agent

.github/workflows/pre-main.yaml

+39-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ name: Test Incoming Changes
1010
env:
1111
COLLECTOR_CONTAINER_NAME: tnf-collector
1212
REGISTRY: quay.io
13-
COLLECTOR_IMAGE_NAME: testnetworkfunction/collector
13+
COLLECTOR_IMAGE_NAME: redhat-best-practices-for-k8s/collector
1414
COLLECTOR_IMAGE_TAG: unstable
15+
COLLECTOR_IMAGE_NAME_LEGACY: testnetworkfunction/collector
1516
jobs:
1617
lint:
1718
name: Run Linter and Vet
@@ -109,10 +110,43 @@ jobs:
109110
env:
110111
COLLECTOR_IMAGE_TAG: ${{ env.COLLECTOR_IMAGE_TAG }}
111112

113+
# Push the new unstable TNF image to Quay.io.
114+
- name: (if on main and upstream) Authenticate against Quay.io
115+
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'redhat-best-practices-for-k8s' }}
116+
uses: docker/login-action@v3
117+
with:
118+
registry: ${{ env.REGISTRY }}
119+
# Use a Robot Account to authenticate against Quay.io
120+
# https://docs.quay.io/glossary/robot-accounts.html
121+
username: ${{ secrets.QUAY_ROBOT_USERNAME_K8S }}
122+
password: ${{ secrets.QUAY_ROBOT_TOKEN_K8S }}
123+
124+
- name: (if on main and upstream) Push the newly built image to Quay.io
125+
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'redhat-best-practices-for-k8s' }}
126+
run: docker push --all-tags ${REGISTRY}/${COLLECTOR_IMAGE_NAME}
127+
128+
- uses: webfactory/[email protected]
129+
name: (if on main and upstream) Add SSH key to agent
130+
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'redhat-best-practices-for-k8s' }}
131+
with:
132+
ssh-private-key: ${{ secrets.COLLECTOR_KEYPAIR }}
133+
134+
build-and-push-image-legacy:
135+
name: "Build and Push Image (Legacy)"
136+
runs-on: ubuntu-22.04
137+
steps:
138+
- name: Check out the code
139+
uses: actions/checkout@v4
140+
141+
# Build Collector image with unstable tag
142+
- name: Build the image
143+
run: make build-image-collector
144+
env:
145+
COLLECTOR_IMAGE_TAG: ${{ env.COLLECTOR_IMAGE_TAG }}
112146

113147
# Push the new unstable TNF image to Quay.io.
114148
- name: (if on main and upstream) Authenticate against Quay.io
115-
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'test-network-function' }}
149+
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'redhat-best-practices-for-k8s' }}
116150
uses: docker/login-action@v3
117151
with:
118152
registry: ${{ env.REGISTRY }}
@@ -122,11 +156,11 @@ jobs:
122156
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
123157

124158
- name: (if on main and upstream) Push the newly built image to Quay.io
125-
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'test-network-function' }}
126-
run: docker push --all-tags ${REGISTRY}/${COLLECTOR_IMAGE_NAME}
159+
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'redhat-best-practices-for-k8s' }}
160+
run: docker push --all-tags ${REGISTRY}/${COLLECTOR_IMAGE_NAME_LEGACY}
127161

128162
- uses: webfactory/[email protected]
129163
name: (if on main and upstream) Add SSH key to agent
130-
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'test-network-function' }}
164+
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'redhat-best-practices-for-k8s' }}
131165
with:
132166
ssh-private-key: ${{ secrets.COLLECTOR_KEYPAIR }}

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else
99
endif
1010

1111
MYSQL_CONTAINER_NAME?=mysql-container
12-
COLLECTOR_IMAGE_NAME?=testnetworkfunction/collector
12+
COLLECTOR_IMAGE_NAME?=redhat-best-practices-for-k8s/collector
1313
COLLECTOR_IMAGE_TAG?=latest
1414
COLLECTOR_CONTAINER_NAME?=cnf-collector
1515
COLLECTOR_NS?=cnf-collector
@@ -26,9 +26,9 @@ GIT_RELEASE=$(shell scripts/get-git-release.sh)
2626
GIT_PREVIOUS_RELEASE=$(shell scripts/get-git-previous-release.sh)
2727
BASH_SCRIPTS=$(shell find . -name "*.sh" -not -path "./.git/*")
2828
GOLANGCI_VERSION=v1.59.1
29-
LINKER_TNF_RELEASE_FLAGS=-X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitCommit=${GIT_COMMIT}
30-
LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitRelease=${GIT_RELEASE}
31-
LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitPreviousRelease=${GIT_PREVIOUS_RELEASE}
29+
LINKER_TNF_RELEASE_FLAGS=-X github.com/redhat-best-practices-for-k8s/certsuite/certsuite.GitCommit=${GIT_COMMIT}
30+
LINKER_TNF_RELEASE_FLAGS+= -X github.com/redhat-best-practices-for-k8s/certsuite/certsuite.GitRelease=${GIT_RELEASE}
31+
LINKER_TNF_RELEASE_FLAGS+= -X github.com/redhat-best-practices-for-k8s/certsuite/certsuite.GitPreviousRelease=${GIT_PREVIOUS_RELEASE}
3232
MYSQL_DEPLOYMENT_PATH = ./k8s/deployment/database.yaml
3333
COLLECTOR_DEPLOYMENT_PATH = ./k8s/deployment/app.yml
3434
DB_URL = database-collectordb-1hykanj2mxdh.cn9luyhgvfkp.us-east-1.rds.amazonaws.com
@@ -212,4 +212,4 @@ run-grafana: clone-tnf-secrets stop-running-grafana-container
212212
# Clones tnf-secret private repo if does not exist
213213
clone-tnf-secrets:
214214
rm -rf tnf-secrets
215-
git clone [email protected]:test-network-function/tnf-secrets.git
215+
git clone [email protected]:redhat-best-practices-for-k8s/tnf-secrets.git

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Cnf Certification's Collector
22

3-
[![release)](https://img.shields.io/github/v/release/test-network-function/collector?color=blue&label=%20&logo=semver&logoColor=white&style=flat)](https://github.com/test-network-function/collector/releases)
3+
[![release)](https://img.shields.io/github/v/release/redhat-best-practices-for-k8s/collector?color=blue&label=%20&logo=semver&logoColor=white&style=flat)](https://github.com/redhat-best-practices-for-k8s/collector/releases)
44
[![red hat](https://img.shields.io/badge/red%20hat---?color=gray&logo=redhat&logoColor=red&style=flat)](https://www.redhat.com)
55
[![openshift](https://img.shields.io/badge/openshift---?color=gray&logo=redhatopenshift&logoColor=red&style=flat)](https://www.redhat.com/en/technologies/cloud-computing/openshift)
66

77
## Description
88

99
A Go-based endpoint for collecting
10-
[Cnf Certification Suites](https://github.com/test-network-function/cnf-certification-test)
10+
[Cnf Certification Suites](https://github.com/redhat-best-practices-for-k8s/certsuite)
1111
results.
1212

1313
The CNF Certification Suites provide a set of test cases for the
@@ -40,7 +40,7 @@ and has to be enabled manually by the user running the CNF Certification Suites.
4040
```
4141

4242
2. Adjust CNF Certification configuration file:\
43-
(see [CNF Certification configuration description](https://test-network-function.github.io/cnf-certification-test/configuration/))
43+
(see [CNF Certification configuration description](https://redhat-best-practices-for-k8s.github.io/certsuite/configuration/))
4444

4545
1. Specify who executed the suites:\
4646
Under the `executedBy` entry in the `tnf_config.yml` file,
@@ -77,14 +77,14 @@ and has to be enabled manually by the user running the CNF Certification Suites.
7777
```
7878
7979
3. Run CNF Certification suites with the adjusted configuration file.\
80-
(see [CNF Certification Test description](https://test-network-function.github.io/cnf-certification-test/test-container/))
80+
(see [CNF Certification Test description](https://redhat-best-practices-for-k8s.github.io/certsuite/test-container/))
8181
8282
#### Option 2 - send a claim.json file directly to Collector
8383
8484
If you haven't already, clone Collector's repository:
8585
8686
```sh
87-
git pull https://github.com/test-network-function/collector.git
87+
git pull https://github.com/redhat-best-practices-for-k8s/collector.git
8888
```
8989
9090
From collector's repo root directory, use the following command:
@@ -109,7 +109,7 @@ can have access to their saved data.\
109109
If you haven't already, clone Collector's repository:
110110
111111
```sh
112-
git pull https://github.com/test-network-function/collector.git
112+
git pull https://github.com/redhat-best-practices-for-k8s/collector.git
113113
```
114114
115115
From collector's repo root directory, use the following command:
@@ -176,7 +176,7 @@ Use the following commands to build and run Collector's container and database l
176176
* **Clone Collector's repository:**
177177

178178
```sh
179-
git pull https://github.com/test-network-function/collector.git
179+
git pull https://github.com/redhat-best-practices-for-k8s/collector.git
180180
```
181181

182182
* **(Optional) Build and Push your Collector image:**
@@ -192,7 +192,7 @@ Use the following commands to build and run Collector's container and database l
192192
```
193193

194194
**Note:** If skipping this step, the colletor container will use
195-
`quay.io/testnetworkfunction/collector:latest` image by default.
195+
`quay.io/redhat-best-practices-for-k8s/collector:latest` image by default.
196196

197197
* **Initialize local Collector DB:**
198198

@@ -209,11 +209,11 @@ Use the following commands to build and run Collector's container and database l
209209
210210
* **Test it out:**
211211
212-
1. Send data to your collector in one of the ways mentioned [above](https://github.com/test-network-function/collector?tab=readme-ov-file#send-data-to-collector),
212+
1. Send data to your collector in one of the ways mentioned [above](https://github.com/redhat-best-practices-for-k8s/collector?tab=readme-ov-file#send-data-to-collector),
213213
setting the endpoint of your local collector app endpoint.
214214
215215
2. Get the data from your collector using the
216-
[above instructions](https://github.com/test-network-function/collector?tab=readme-ov-file#option-1---for-both-admin-and-partners)
216+
[above instructions](https://github.com/redhat-best-practices-for-k8s/collector?tab=readme-ov-file#option-1---for-both-admin-and-partners)
217217
, setting the endpoint of your local collector app endpoint and
218218
credentials of the sent data.
219219

api/auth.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"database/sql"
55
"fmt"
66

7-
"github.com/test-network-function/collector/util"
7+
"github.com/redhat-best-practices-for-k8s/collector/util"
88
"golang.org/x/crypto/bcrypt"
99
)
1010

api/parser.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"net/http"
77

8-
"github.com/test-network-function/collector/util"
8+
"github.com/redhat-best-practices-for-k8s/collector/util"
99
)
1010

1111
func parseClaimFile(w http.ResponseWriter, r *http.Request) (map[string]interface{}, error) {

api/parser_handler.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"net/http"
55
"strings"
66

7+
"github.com/redhat-best-practices-for-k8s/collector/storage"
8+
"github.com/redhat-best-practices-for-k8s/collector/util"
79
"github.com/sirupsen/logrus"
8-
"github.com/test-network-function/collector/storage"
9-
"github.com/test-network-function/collector/util"
1010
)
1111

1212
//nolint:funlen

api/result_handler.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"encoding/json"
66
"net/http"
77

8+
"github.com/redhat-best-practices-for-k8s/collector/storage"
9+
"github.com/redhat-best-practices-for-k8s/collector/types"
10+
"github.com/redhat-best-practices-for-k8s/collector/util"
811
"github.com/sirupsen/logrus"
9-
"github.com/test-network-function/collector/storage"
10-
"github.com/test-network-function/collector/types"
11-
"github.com/test-network-function/collector/util"
1212
)
1313

1414
func ResultsHandler(w http.ResponseWriter, r *http.Request, mysqlStorage *storage.MySQLStorage) {

api/server.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"net/http"
55
"time"
66

7+
"github.com/redhat-best-practices-for-k8s/collector/storage"
8+
"github.com/redhat-best-practices-for-k8s/collector/util"
79
"github.com/sirupsen/logrus"
8-
"github.com/test-network-function/collector/storage"
9-
"github.com/test-network-function/collector/util"
1010
)
1111

1212
type Server struct {

api/upload_handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"github.com/aws/aws-sdk-go-v2/credentials"
1111
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
1212
"github.com/aws/aws-sdk-go-v2/service/s3"
13+
"github.com/redhat-best-practices-for-k8s/collector/util"
1314
"github.com/sirupsen/logrus"
14-
"github.com/test-network-function/collector/util"
1515
)
1616

1717
func configS3(region, accessKey, secretAccessKey string) *s3.Client {

api/validator.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"fmt"
66
"net/http"
77

8-
"github.com/test-network-function/collector/types"
9-
"github.com/test-network-function/collector/util"
8+
"github.com/redhat-best-practices-for-k8s/collector/types"
9+
"github.com/redhat-best-practices-for-k8s/collector/util"
1010
)
1111

1212
func validatePostRequest(w http.ResponseWriter, r *http.Request) ([]types.ClaimResult, []string, error) {

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/test-network-function/collector
1+
module github.com/redhat-best-practices-for-k8s/collector
22

33
go 1.22.5
44

k8s/deployment/app.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spec:
2424
spec:
2525
containers:
2626
- name: collector-container
27-
image: quay.io/testnetworkfunction/collector:latest
27+
image: quay.io/redhat-best-practices-for-k8s/collector:latest
2828
env:
2929
- name: DB_URL
3030
value: "mysql.cnf-collector.svc.cluster.local"

main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"time"
55

66
_ "github.com/go-sql-driver/mysql"
7+
"github.com/redhat-best-practices-for-k8s/collector/api"
8+
"github.com/redhat-best-practices-for-k8s/collector/storage"
9+
"github.com/redhat-best-practices-for-k8s/collector/util"
710
"github.com/sirupsen/logrus"
8-
"github.com/test-network-function/collector/api"
9-
"github.com/test-network-function/collector/storage"
10-
"github.com/test-network-function/collector/util"
1111
)
1212

1313
func main() {

0 commit comments

Comments
 (0)