Skip to content

Commit

Permalink
spacewalk 2.10
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Salmela <[email protected]>
  • Loading branch information
jacobsalmela committed Apr 5, 2020
1 parent 71a1017 commit a428f00
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Dockerfile-centos
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM centos:7

MAINTAINER Jacob Salmela <[email protected]>

RUN yum install -y https://copr-be.cloud.fedoraproject.org/results/@spacewalkproject/spacewalk-2.9/epel-7-x86_64/00830557-spacewalk-repo/spacewalk-repo-2.9-4.el7.noarch.rpm \
RUN yum install -y https://copr-be.cloud.fedoraproject.org/results/%40spacewalkproject/spacewalk-2.10/epel-7-x86_64/01259466-spacewalk-repo/spacewalk-repo-2.10-8.el7.noarch.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \
yum clean all

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ https://jacobsalmela.com/2019/02/18/spacewalk-containerized-and-running-in-kuber
## Pull prebuilt images from Github or Docker
```
# Github
docker pull docker.pkg.github.com/jacobsalmela/spacewalk-k8s/spacewalk:2.9
docker pull docker.pkg.github.com/jacobsalmela/spacewalk-k8s/spacewalk-postgres:2.9
docker pull docker.pkg.github.com/jacobsalmela/spacewalk-k8s/spacewalk:2.10
docker pull docker.pkg.github.com/jacobsalmela/spacewalk-k8s/spacewalk-postgres:2.10
# Docker
docker pull jacobsalmela/spacewalk:2.9
docker pull jacobsalmela/spacewalk-postgres:2.9
docker pull jacobsalmela/spacewalk:2.10
docker pull jacobsalmela/spacewalk-postgres:2.10
```
## Spacewalk as a Kubernetes deployment, why?
Expand Down Expand Up @@ -40,9 +40,9 @@ The Dockerfile does most everything, but the last program `supervisord` runs is
```
git clone <this repo>
cd <this repo>
docker build -t spacewalk:2.9 -f Dockerfile-centos .
docker build -t spacewalk:2.10 -f Dockerfile-centos .
cd postgres/
docker build -t spacewalk-postgres:2.9 .
docker build -t spacewalk-postgres:2.10 .
cd ..
kubectl create -f spacewalk-pv/
kubectl create -f spacewalk/
Expand Down Expand Up @@ -74,7 +74,7 @@ or [https://127.0.0.1:8443/rhn/Login.do](https://127.0.0.1:8443/rhn/Login.do) if
I tested with a container here as an example, but the steps are the same for a traditional server or VM (per https://github.com/spacewalkproject/spacewalk/wiki/RegisteringClients#red-hat-enterprise-linux-5-6-and-7-scientific-linux-6-and-7-centos-5-6-and-7)

```
rpm -Uvh https://copr-be.cloud.fedoraproject.org/results/%40spacewalkproject/spacewalk-2.9-client/epel-7-x86_64/00830558-spacewalk-repo/spacewalk-client-repo-2.9-4.el7.noarch.rpm
rpm -Uvh https://copr-be.cloud.fedoraproject.org/results/%40spacewalkproject/spacewalk-2.10/epel-7-x86_64/01259466-spacewalk-repo/spacewalk-client-repo-2.10-8.el7.noarch.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install rhn-client-tools rhn-check rhn-setup rhnsd m2crypto yum-rhn-plugin
rpm -Uvh http://<SPACEWALK WEB CONTAINER>/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm
Expand Down
6 changes: 3 additions & 3 deletions postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM postgres:10.5
FROM postgres:10.11

MAINTAINER Jacob Salmela <[email protected]>
MAINTAINER Jacob Salmela <[email protected]>

RUN apt-get update && \
apt-get install -y postgresql-pltcl-10

# Install the main.sql file from a clean install of Spacewalk 2.9 so it populates the database correctly
# Install the main.sql file from a clean install of Spacewalk 2.10 so it populates the database correctly
ADD main.sql /docker-entrypoint-initdb.d/
81 changes: 72 additions & 9 deletions postgres/main.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- main.sql from a clean 2.9 install found at /etc/sysconfig/rhn/postgres/main.sql
-- main.sql from a clean 2.10 install found at /etc/sysconfig/rhn/postgres/main.sql
-- Spacewalk needs this additional language installed
CREATE LANGUAGE pltclu;
CREATE USER spaceuser SUPERUSER;
Expand Down Expand Up @@ -2230,7 +2230,8 @@ CREATE TABLE rhnPackage
header_start NUMERIC
DEFAULT (-1) NOT NULL,
header_end NUMERIC
DEFAULT (-1) NOT NULL
DEFAULT (-1) NOT NULL,
multi_arch VARCHAR(16)
)

;
Expand Down Expand Up @@ -3029,7 +3030,8 @@ CREATE UNIQUE INDEX rhn_cs_label_uq
ON rhnContentSource(org_id, label)
;
CREATE UNIQUE INDEX rhn_cs_repo_uq
ON rhnContentSource(org_id, type_id, source_url)
ON rhnContentSource(org_id, type_id, source_url,
(case when label like 'manifest_%' then 1 else 0 end))
;


Expand Down Expand Up @@ -9154,7 +9156,7 @@ CREATE TABLE rhnXccdfIdent
identsystem_id NUMERIC NOT NULL
CONSTRAINT rhn_xccdf_ident_system_fk
REFERENCES rhnXccdfIdentsystem (id),
identifier VARCHAR (100) NOT NULL
identifier VARCHAR (255) NOT NULL
)

;
Expand Down Expand Up @@ -15477,22 +15479,67 @@ $$ language 'plpgsql';
two := str2;

<<segment_loop>>
while one <> '' and two <> ''
while one <> '' or two <> ''
loop
declare
segm1 VARCHAR;
segm2 VARCHAR;
onechar CHAR(1);
twochar CHAR(1);
begin
--DBMS_OUTPUT.PUT_LINE('Params: ' || one || ',' || two);
--raise notice 'Params: %, %', one, two;
-- Throw out all non-alphanum characters
while one <> '' and not rpm.isalphanum(one)
onechar := substr(one, 1, 1);
twochar := substr(two, 1, 1);
while one <> '' and not rpm.isalphanum(one) and onechar != '~' and onechar != '^'
loop
one := substr(one, 2);
end loop;
while two <> '' and not rpm.isalphanum(two)
while two <> '' and not rpm.isalphanum(two) and twochar != '~' and twochar != '^'
loop
two := substr(two, 2);
end loop;
--raise notice 'new params: %, %', one, two;

onechar := substr(one, 1, 1);
twochar := substr(two, 1, 1);
--raise notice 'new chars 1: %, %', onechar, twochar;
/* handle the tilde separator, it sorts before everything else */
if (onechar = '~' or twochar = '~')
then
if (onechar != '~') then return 1; end if;
if (twochar != '~') then return -1; end if;
--raise notice 'passed tilde chars: %, %', onechar, twochar;
one := substr(one, 2);
two := substr(two, 2);
continue;
end if;

/*
* Handle caret separator. Concept is the same as tilde,
* except that if one of the strings ends (base version),
* the other is considered as higher version.
*/
onechar := substr(one, 1, 1);
twochar := substr(two, 1, 1);
--raise notice 'new chars 2: %, %', onechar, twochar;
if (onechar = '^' or twochar = '^')
then
if (one = '') then return -1; end if;
--raise notice 'passed caret chars 1: %, %', onechar, twochar;
if (two = '') then return 1; end if;
--raise notice 'passed caret chars 2: %, %', onechar, twochar;
if (onechar != '^') then return 1; end if;
--raise notice 'passed caret chars 3: %, %', onechar, twochar;
if (twochar != '^') then return -1; end if;
--raise notice 'passed caret chars 4: %, %', onechar, twochar;
one := substr(one, 2);
two := substr(two, 2);
continue;
end if;

if (not (one <> '' and two <> '')) then exit segment_loop; end if;

str1 := one;
str2 := two;
if str1 <> '' and rpm.isdigit(str1)
Expand Down Expand Up @@ -40748,6 +40795,10 @@ insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '9DB62FB1', lookup_package_key_type('gpg'), lookup_package_provider('Fedora'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '429476B4', lookup_package_key_type('gpg'), lookup_package_provider('Fedora'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), 'CFC659B9', lookup_package_key_type('gpg'), lookup_package_provider('Fedora'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '3C3359C4', lookup_package_key_type('gpg'), lookup_package_provider('Fedora'));

insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), 'a8a447dce8562897', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
Expand All @@ -40764,6 +40815,8 @@ insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '0946fca2c105b9de', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '24c6a8a7f4a80eb5', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '05b555b38483c65d', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));


insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
Expand Down Expand Up @@ -40819,6 +40872,14 @@ insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '41605346066e5810', lookup_package_key_type('gpg'), lookup_package_provider('Spacewalk'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), 'dcc981cdb8002de1', lookup_package_key_type('gpg'), lookup_package_provider('Spacewalk'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '3ae9b50430912c76', lookup_package_key_type('gpg'), lookup_package_provider('Spacewalk'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '770ce53ebc2e6843', lookup_package_key_type('gpg'), lookup_package_provider('Spacewalk'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), 'e481344adba67ea3', lookup_package_key_type('gpg'), lookup_package_provider('Spacewalk'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), 'd4b984391b9881e5', lookup_package_key_type('gpg'), lookup_package_provider('Spacewalk'));


insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
Expand All @@ -40827,6 +40888,8 @@ insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '3b49df2a0608b895', lookup_package_key_type('gpg'), lookup_package_provider('EPEL'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '6a2faea2352c64e5', lookup_package_key_type('gpg'), lookup_package_provider('EPEL'));
insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(sequence_nextval('rhn_pkey_id_seq'), '21ea45ab2f86d6a1', lookup_package_key_type('gpg'), lookup_package_provider('EPEL'));


commit;
Expand Down Expand Up @@ -42816,7 +42879,7 @@ INSERT INTO rhnVersionInfo
)
( SELECT 'schema',
lookup_package_name('spacewalk-schema'),
lookup_evr(NULL, '2.9.11' , '1.el7' )
lookup_evr(NULL, '2.10.11' , '1.el7' )
FROM dual
);
commit;
Expand Down
2 changes: 1 addition & 1 deletion spacewalk/postgres-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
claimName: spacewalk-postgres-claim
containers:
- name: postgres
image: jacobsalmela/spacewalk-postgres:2.9
image: jacobsalmela/spacewalk-postgres:2.10
imagePullPolicy: Always
ports:
- containerPort: 5432
Expand Down
2 changes: 1 addition & 1 deletion spacewalk/spacewalk-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
name: spacewalk-httpd-magic
containers:
- name: spacewalk
image: jacobsalmela/spacewalk:2.9
image: jacobsalmela/spacewalk:2.10
imagePullPolicy: Always
resources:
limits:
Expand Down

0 comments on commit a428f00

Please sign in to comment.