Skip to content

Conversation

@iMarbot
Copy link
Collaborator

@iMarbot iMarbot commented Sep 26, 2022

Summary

Continuing the previous PR forward into the discussed merge of shell scripts into one. Plus adding scheduled deploy action once a week.

Things of note

  • I left the HTTP Auth header in the curl requests since it was just easier and it doesn't break anything. Idk if you guys want to only have them there if it's dev wiki but I didn't know of a clean and easy way to do it, so I left them for now.
  • I added an if statement around the rm cookie_* at the end because it would throw an error otherwise when they didn't exist due to no lua files being modified.

How did you test this change?

Tested on my fork of the repo as usual.

Scheduled script seems to work:
image

Dev wiki deployment also works:
image
http://darkrai.wiki.tldev.eu/commons/index.php?title=Module:Testing&action=history

So, I'm sure full wiki deploy would also work but I just didn't give it any MediaWiki credentials so the API returned that I wasn't authorized to make those changes:
image

@iMarbot iMarbot changed the title Updated deploy continued Rework new deploy script into single script & add scheduled redeploy Sep 26, 2022
Copy link
Collaborator

@mbergen mbergen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

iMarbot and others added 2 commits September 26, 2022 12:58
Co-authored-by: mbergen <mail@mbergen.de>
Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>
deploy.sh Outdated
wiki="${BASH_REMATCH[1]}"
page="${BASH_REMATCH[2]}"

if [[ ! ($wikiBaseUrl == "${lpBaseUrl}" || "${devWikis[*]}" =~ ${wiki}) ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of operations here is confusing tbh, can this be put in parentheses?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better now or did you mean something else?

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>
iMarbot and others added 4 commits September 26, 2022 21:14
Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>
* Add TF wiki
* Modify `./` handling
* Move URLs to secrets
* Clarify `if` statement
Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>
@iMarbot
Copy link
Collaborator Author

iMarbot commented Sep 26, 2022

@FO-nTTaX I added this code here so we can detect if the MW API doesn't return success. Are you okay with this change?

Lua-Modules/deploy.sh

Lines 118 to 122 in 284e92d

if [[ "${result}" == "Success" ]]; then
echo "...${result}"
else
exit 1
fi

@iMarbot
Copy link
Collaborator Author

iMarbot commented Sep 26, 2022

All changes have been tested in my repo fork but as always, it's possible I did miss something.

Copy link
Collaborator

@Rathoz Rathoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, think there's potential for improvements around the dev wiki handling, but we that can be put to a later date

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>
@iMarbot
Copy link
Collaborator Author

iMarbot commented Sep 26, 2022

LGTM, think there's potential for improvements around the dev wiki handling, but we that can be put to a later date

Yeah FO had suggested something like --dev but when I looked into how to do that in bash, I didn't find any clean way to do it. Maybe it's because I don't know bash well but my googling didn't result in anything I felt was clean to use.

@FO-nTTaX
Copy link
Member

I added this code here so we can detect if the MW API doesn't return success. Are you okay with this change?

Works for me

Copy link
Member

@FO-nTTaX FO-nTTaX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to go now

@FO-nTTaX
Copy link
Member

LGTM, think there's potential for improvements around the dev wiki handling, but we that can be put to a later date

Yeah FO had suggested something like --dev but when I looked into how to do that in bash, I didn't find any clean way to do it. Maybe it's because I don't know bash well but my googling didn't result in anything I felt was clean to use.

https://en.wikipedia.org/wiki/Getopts#Using_Linux_getopt In case you ever want to know how to do it

@iMarbot iMarbot merged commit c561dd8 into updated-deploy Sep 27, 2022
@FO-nTTaX FO-nTTaX deleted the updated-deploy-continued branch September 27, 2022 11:02
Rathoz added a commit that referenced this pull request Sep 27, 2022
* Update deploy.yml

* Update deploy.sh

* Update deploy.yml

* Update deploy_dev.yml

* Update deploy_dev.sh

* Update deploy.yml

* Update deploy_dev.yml

* Finalize deploy changes

* code style

* fix for multi-file changing commits

* remove double space

* action will potentially fail without this

* action will potentially fail without this

* Rework new deploy script into single script & add scheduled redeploy (#1950)

* Merge dev stuff into combined deploy

* Delete deploy_dev.sh

* Merge deploy actions

* Add scheduled deploy action

Should run every Monday at 00:00 UTC

* Update deploy.yml

* fix swapped env blocks

* Fix incorrect script call

Co-authored-by: mbergen <mail@mbergen.de>

* Update cron times

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Only run bash script if files have been modified

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Further only run bash script if files have been modified

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Apply all suggestions/requests

* Add TF wiki
* Modify `./` handling
* Move URLs to secrets
* Clarify `if` statement

* Throw error is MW API doesn't return Success

* Bump version

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Swap around if statement

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

Co-authored-by: mbergen <mail@mbergen.de>
Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

Co-authored-by: mbergen <mail@mbergen.de>
Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>
Rathoz added a commit that referenced this pull request Oct 4, 2022
* Update deploy.yml

* Update deploy.sh

* Update deploy.yml

* Update deploy_dev.yml

* Update deploy_dev.sh

* Update deploy.yml

* Update deploy_dev.yml

* Finalize deploy changes

* code style

* fix for multi-file changing commits

* remove double space

* action will potentially fail without this

* action will potentially fail without this

* Rework new deploy script into single script & add scheduled redeploy (#1950)

* Merge dev stuff into combined deploy

* Delete deploy_dev.sh

* Merge deploy actions

* Add scheduled deploy action

Should run every Monday at 00:00 UTC

* Update deploy.yml

* fix swapped env blocks

* Fix incorrect script call

Co-authored-by: mbergen <mail@mbergen.de>

* Update cron times

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Only run bash script if files have been modified

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Further only run bash script if files have been modified

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Apply all suggestions/requests

* Add TF wiki
* Modify `./` handling
* Move URLs to secrets
* Clarify `if` statement

* Throw error is MW API doesn't return Success

* Bump version

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Swap around if statement

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

Co-authored-by: mbergen <mail@mbergen.de>
Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

Co-authored-by: mbergen <mail@mbergen.de>
Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>
Rathoz added a commit that referenced this pull request Oct 4, 2022
* Update deploy.yml

* Update deploy.sh

* Update deploy.yml

* Update deploy_dev.yml

* Update deploy_dev.sh

* Update deploy.yml

* Update deploy_dev.yml

* Finalize deploy changes

* code style

* fix for multi-file changing commits

* remove double space

* action will potentially fail without this

* action will potentially fail without this

* Rework new deploy script into single script & add scheduled redeploy (#1950)

* Merge dev stuff into combined deploy

* Delete deploy_dev.sh

* Merge deploy actions

* Add scheduled deploy action

Should run every Monday at 00:00 UTC

* Update deploy.yml

* fix swapped env blocks

* Fix incorrect script call

Co-authored-by: mbergen <mail@mbergen.de>

* Update cron times

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Only run bash script if files have been modified

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Further only run bash script if files have been modified

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Apply all suggestions/requests

* Add TF wiki
* Modify `./` handling
* Move URLs to secrets
* Clarify `if` statement

* Throw error is MW API doesn't return Success

* Bump version

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

* Swap around if statement

Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

Co-authored-by: mbergen <mail@mbergen.de>
Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>

Co-authored-by: mbergen <mail@mbergen.de>
Co-authored-by: Rikard Blixt <rikardblixt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants